Hi <@U06493SNA3U> , WireMock doesn’t have the abil...
# help
t
Hi @Orçun BALCILAR , WireMock doesn’t have the ability built in to change its response based on a proxy response, but you could create a
ResponseTransformerV2
implementation that could do something like this.
o
OK, thanks @Tom 🙂, yes I've chosen the same way. I looked at the doc not to create duplicate coding. But I couldn't find and wanted to ask. So, do you have any plan to implement it?
t
This isn’t something we have planned right now, as it’s not something we’re regularly asked about and I think it could be tricky to get right in the general case. I’d be tempted to consider whether this is the right approach, or whether there’s a way you can reorganise your test setup such that you don’t need this feature.
1
o
Hmm, I just thought that I could return the real service's response if it is up to make the flow in web app not to be broken. Because we've just started to virtualize. And later pages call real services right now. So, other api could need a state. For example, if a customer that have 100 USD is virtualized with a budget of 10 USD, purchasing could be failed due to insufficient budget. The numbers are for sure flexible. That's why perhaps I could need a real service response first. We are new to virtualization and learning. Maybe we are missing some point.
t
What kind of testing are you supporting with your mocks? i.e. is automated functional (integration) tests, performance, manual exploratory?
o
automated functional (integration) tests -> ui and maybe api testing
t
OK, there are usually ways to set your tests up such that you don’t need full statefulness or much logic in your mocks
o
Actually I need statefulness for the whole flow. But ok let's explore more virtualization and ui. Maybe we don't need it. Thank you for your help.
t
If you’re testing workflows that involve a few state transitions in the system you’re mocking you can simulate statefulness with scenarios, and this tends to be a lot simpler to reason about than full mutability
Or if you can design your tests to be granular and deal with single states or state transitions then you can avoid statefulness altogether
o
Hmm, I had seen this feature -> https://wiremock.org/docs/stateful-behaviour/ . And I have also discovered wiremock state extension today. I will try both. Thank you. I think you're talking about this one. Right?
t
Yes, that's the one
I'd suggest trying that first and graduating to the extension only for advanced cases
o
Hmm, ok thank you, I will keep it in my mind.