Mock a REST API Response in ATF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2018 11:05 AM
We have a situation where we have a form that is making a REST call upon submission to an outside system to validate some data. We want to put automated testing around the form and it's various uses, but we need a way to catch that API call, stop it from making it, and provide a response to the system that is was successful, a failure, a timeout, etc. We don't want our test to be reliant on calling that outside system. If I could do with with Python, I would use a mock, but I'm unfamiliar with anything like that in JavaScript or if there's a way to do this in the automated test framework. Any suggestions?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2018 02:05 PM
You'd likely have to make a customized step config to do this but with that you could tell the config what endpoint, the payload, and the response data since you're making it all up anyways.
I am heading up a open source project to make tests for all the things in servicenow, and this case hasn't come up but I can see how it would be useful. Feel free to open an issue with a use case and I'll get it added.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2022 06:50 AM
Hi Mark,
I came across this question couple days back. Have you found a solution for mocking an Outbound REST message in ATF ? If yes, could you kindly share the details ?
Thanks!!