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

xiao ma

12/15/2023, 8:02 AM
When I considered using Wirelock for integration testing to solve the problem of excessive coupling in microservices and process testing relying on multiple microservices, I found that it can be used as a separate mock server. However, what puzzled me was how to decide whether to call a normal interface or a mock server in my current application. Does this logic need to be implemented by myself? I would be very grateful if someone could help answer my questions
t

Tom

12/15/2023, 10:23 AM
Hi @xiao ma, I would say it depends on your context to some extent. There are some teams who mix mocks with real APIs e.g. you might run your real login service but mock your payments service while testing. I would suggest you mock anything where it’s hard to set up the test conditions you need, or that the real API’s sandbox is slow/flakey/incorrect in some way. Having said that there are teams who test each service completely isolated via mocks (us included). This can have significant advantages in terms of speed and reliability of test execution, not to mention flexibility in defining both happy path and negative test conditions.
x

xiao ma

12/17/2023, 4:52 AM
Thank you for your answer. I think we are currently in a mixed scenario where we only need to request mock servers from specific interfaces. What I would like to know more is whether we need to implement routing for interfaces ourselves?
t

Tom

12/18/2023, 9:34 AM
Provided you can set the base URL or domain name for each API your service communicates with, that it usually enough
So you’d e.g. change a setting like
<https://api.stripe.com>
->
<https://mock-stripe.mymockapis.com>
x

xiao ma

12/23/2023, 8:53 AM
Thank you, I understand what you mean