Hello everybody! That's the question. We use Wirem...
# help
т
Hello everybody! That's the question. We use Wiremock JSON to mock in vendor responses in our tests. Often, suppliers may send different responses to the same request. To do this, we use scenarios to get the right response at the right time. Previously, we implemented it in such a way that wiremock was raised for each test. Consequently, the scenarios were not interrupted in any way. Now we plan to raise 1 wiremock for multithreaded tests (20+ units). What will happen to the scenarios? Will they be able to run parallel to each other?
Or if we have one scenario already started, then the rest simply won't return anything, because the first one hasn't ended?
t
If you’re using a fixed set of JSON mappings then the problem you’ll probably find is that one thread bumps the scenario state that then affects the outcome of a test in another thread. There are 3 ways you can address this: 1. Switch to code-based stubs and create unique stubs and scenarios per test case. 2. Use the state extension in order to create a more sophisticated state setup that takes account of some kind of thread/session segregator e.g. a user session ID, header value 3. Use WireMock Cloud’s advanced state feature, whereby a root state context can be configured via templating that can be session ID, header etc.
🙌 1