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:

  1. Creation of the tests for running HTTP requests with specified queries/headers.
  2. Combination of tests into groups (e.g. run authentication test first and then use token or session id in the next tests)
  3. Validation of certain JSON fields in the response (ideally without regexp)

Results are the following:

  1. JMeter with JSON Path Exctractor plugin

  2. Selenium 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.
    • selenium-webdriver-firefox-browser-driver
  3. postman

    • 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
    • postman tests
  4. Runscope

    • Web service is commercial; there is a free plan with up to 25k requests per month
    • Looks promising however I have not spent much time on this so just adding it to the bottom of my list for now
    • runscope tests

Читайте также: