1

I have a Master API exposed which calls microservice A and A then called a third party microservice B. I want to mock Service B.

Master--->A---->B(third party) need to be mocked. I am testing request response from Master. How this can be performed in Karate. I do understand mocking of a A if I am calling Master->A, But here case is mocking B. Need inputs for this. Thankyou.

  • Hi, are you able to show what you have tried, what you want and what you're currently experiencing? – Joshua Dec 21 '20 at 04:18
  • @Joshua We have a REST API exposed to frontend, I am calling Master Rest API, which basically calls multiple grpc microservices internally owned by us in order(A->B->C), Also C makes a call to D, a third party which results in dynamic response. I want to mock the third party so that I always gets a standard response for that request. – user9177035 Dec 21 '20 at 04:34
  • this will likely need to be done by creating a passthrough server (that you own) which does the mocking aka (for $request_a return $mocked_b), or reach out to the 3rd party and see if they have a dev environment that you can play with without modifying "live" data. – Joshua Dec 21 '20 at 04:38
  • @Joshua Sure thanks, (for $request_a return $mocked_b), We do have exposed a header(URLs) that needs to be passed in request to tell that the request should go to a mock server(URLs) and not an actual 3rd party. What I need help with is how can I use karate to run a mock server provided by Karate(netty) and return mocked responses for this particular request from a third party to microservice C (Master->A->B->C->third-party). I have written a feature file for the Master API call. Now for which one I should write the mock feature file. – user9177035 Dec 21 '20 at 05:12
  • @user9177035 please read the question I linked – Peter Thomas Dec 21 '20 at 05:29

0 Answers0