Forum Discussion

WilliamWilliams's avatar
WilliamWilliams
Occasional Contributor
2 years ago

Is it possible to simulate a 500 or other non-200 response with AutoMocking?

In order to test my api in SwaggerHub it'd be nice to simulate the response for a 500, 201, 400, etc and make sure that the format of the response is what I expect.  Is this possible?  When I try a new integration and set up automock that option isn't shown.

Thank you!

  • chichepo's avatar
    chichepo
    Champion Level 2

    Hi WilliamWilliams 

    Just wondering if commenting the 200 response is enough? When trying it, you should get the error message first.

     

    • WilliamWilliams's avatar
      WilliamWilliams
      Occasional Contributor

      Unfortunately not.  If I do like you did above the response just says "undocumented" above the previous 200 response.  Or I get a 406 error.  I would need the mocked up server code to throw a 500.  Not sure exactly how they implement that mocking functionality.