# help

Markus Jevring

10/18/2023, 9:51 AM
Hey. When running WireMock with port=0, it will choose a port at random. In some cases, however, this leads to WireMock terminating prematurely, in the middle of the test. It doesn't happen very often, but once it starts happening in a project, it's almost always in the same place. This can be fixed by setting an explicit port in WireMock, but then we have to re-create the context for each test, as that forces the equivalent of
. I'm not sure if this is due to WireMock itself, or
. Any thoughts on how I might fix this?
to make it even weirder, it only happens when I run the tests through gradle. When I test with IntelliJ IDEA, everything works fine