https://linen.dev logo
#help
Title
# help
t

Tom

01/26/2024, 10:14 AM
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

Orçun BALCILAR

01/26/2024, 10:38 AM
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

Tom

01/26/2024, 10:43 AM
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

Orçun BALCILAR

01/26/2024, 10:55 AM
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

Tom

01/26/2024, 11:58 AM
What kind of testing are you supporting with your mocks? i.e. is automated functional (integration) tests, performance, manual exploratory?
o

Orçun BALCILAR

01/26/2024, 11:59 AM
automated functional (integration) tests -> ui and maybe api testing
t

Tom

01/26/2024, 11:59 AM
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

Orçun BALCILAR

01/26/2024, 12:03 PM
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

Tom

01/26/2024, 12:22 PM
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

Orçun BALCILAR

01/26/2024, 12:34 PM
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

Tom

01/26/2024, 12:35 PM
Yes, that's the one
I'd suggest trying that first and graduating to the extension only for advanced cases
o

Orçun BALCILAR

01/26/2024, 12:37 PM
Hmm, ok thank you, I will keep it in my mind.