How we automate API testing in ZIWO

21 - Dec - 2020 All   Customer Support   Developer   Integrations   QA   StartUp   Uncategorized  

It’s not a secret that when the tests are automated, it eliminates human errors, saves time and money. Automated tests bring full confidence in our API testing behavior and consistency.

ZIWO is an API-Centric Web Application, so API test automation is the most important one for us.

The process

Test creation
  • We use Postman to write tests. Postman is a tool used by software developers and testers worldwide for API testing that provides a wide range of features and is really easy to use.
  • Tests are written using JavaScript syntax, most used NodeJs libraries are: faker.js, chai.js, moment.js, lodash.
  • Testing something like HTTP status codes, for example, can be done using a simple script like this (and Postman even has snippets for it):


  • We use advanced JavaScript logic to validate responses, schemas, check expected and unexpected users’ behaviour, and dynamically control Postman’s workflow.

This is an example of a request with several tests in Postman:

  • The tests tab on the request itself when a test is for one request only.


  • The tests tab on the folder level is very useful to apply tests to each request.

api test - automate

  • Since we have a lot of endpoints and different scenarios to check, our test base is pretty complex. To make it easier to maintain it’s organised into test collections, then top-level folders and sub-folders.

api test

As you can see on the picture above, the test suit will be executed in 4 phases and we have top-level folders for that:

  1. Pre-request folder where we log in the agents.
  2. Tests for a regular agent + pre-request actions (changing settings, generating and saving data for tests).
  3. The same for a desk agent.
  4. Post-request: reverting all the changes, removing some fake data.

Test execution

To check the workflow locally during test development we use Postman collection runner. It’s an easy way to run all the requests quickly and visualise results.

This is the Runner:


Postman allows dynamically control the workflow, like this:


When the test suit is ready to be used, we switch to another tool – Newman CLI, because it allows us to use Postman tests as a part of our CI/CD process.

CI/CD and Postman tests

We use GitHub actions for this purpose. Every time our developers want to merge the changes to the master branch, we add a label to a PR and it triggers a Newman CLI test.



All the test results are stored in influxDB and we also generate some reports with Grafana:

api test

Share this