:wave: Hello, team! I have written unit tests for ...
# wiremock-java
👋 Hello, team! I have written unit tests for 2 controllers using wiremock and now getting following error in test environment "FatalStartup java.lang.RuntimeException: java.io.IOException: Failed to bind to /" All tests runs fine in local environment but fails in test environment with above error. Any suggestions to fix above issue
Hi Have you hardcoded the WireMock port to
? It looks like something in your test environment is already using that port so WireMock can't bind to it. I would recommend configuring WireMock to use a dynamic port number so you are less likely to clash with other things
You can configure WireMock with dynamic ports in the following way
Copy code
There is also a