1

Question about Karate: can the .feature Mock files intercept calls from back-end Java service class?

I think the mocking feature is pretty easy to understand. I can see that you can start the mock server in the background step and then your scenario HTTP calls will be intercepted BUT

My question is: is it possible to intercept HTTP calls coming from my back-end service class after I hit my API endpoint with a Karate step?

If I don't get an answer, I will put together a sample project and experiment. Just hoping someone knows off-hand. If not, I think I can probably run an instance of Mountebank.

djangofan
  • 28,471
  • 61
  • 196
  • 289

1 Answers1

0

It may be possible by telling the JVM to use an HTTP proxy, but it depends a lot on the system under test.

You can find more details here: https://stackoverflow.com/a/61414022/143475

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248