I'm using WireMock as a standalone service configured via JSON. Say I have an app where you can create, delete, and view notes. I'd like to test concurrent access to it, so my tests would have multiple threads exercising the app. My goal is to have POST/DELETE modify the response returned by GET. The results of each POST/DELETE may (should) be visible to other threads, but are not allowed to modify work done by them.
I set up a Scenario such that:
- upon POST note1
- GET returns note1
- upon DELETE
- GET returns nothing
Now I'd like to test multiple concurrent requests, so:
- upon POST note1
- GET returns note1
- upon POST note2
- GET returns note1, note2
- upon DELETE note1
- GET returns note2
Is there a way to achieve this via Scenarios/response-templating or somehow else without having to modify the response mapping of the GET from within my tests on the fly?
edit: my present solution would be to edit the response mapping on the fly from within the test code. So each thread would read the current response mapping for the GET, modify it per the work it's done, and repost it. While this works, I think it's less than ideal since it requires muddling the business logic under test with the details of the tools used to execute the tests.