Validation of REST API JSON responses
Even though you can create unit tests using coding language used at your project sometimes it is better to decouple these tasks and create tests separately from the main codebase to be able to add/update them by separate team (e.g. QA guys).
So the goal of the research was to find some tool that will allow:
- Creation of the tests for running HTTP requests with specified queries/headers.
- Combination of tests into groups (e.g. run authentication test first and then use token or session id in the next tests)
- Validation of certain JSON fields in the response (ideally without regexp)
Results are the following:
-
JMeter with JSON Path Exctractor plugin
- http://jmeter-plugins.org/wiki/JSONPathExtractor/
- Open source softare
- Allow you to create test cases and validate response via UI which is great for training QA team to create and run such dedicated tests
-
Selenium Webdriver
- http://www.seleniumhq.org/projects/webdriver/
- Open source solution that can be used for different functional tests and supports multiple coding languages however IMHO JMeter with JSON Extractor plugin is better for such kind of tests when you are focused on the http requests parameters and validation of the response.
-
postman
- https://www.getpostman.com/
- Postman itself is free REST client however Jetpacks needed for creating / running tests cost $9.99 for a single license (per user). Free upgrades for life.
- There is a separate package called newman that can be used to automate running of the created test on the server side https://www.npmjs.com/package/newman
-
Runscope