api-test

Light weight automated JSON API testing framework. Run API tests from the terminal.

Follow @subeshb1 Star Github CI Badge api-test release version Badge

Organize your test cases in a JSON file

{
  "testCases": {
    "my_first_test_case": {
      "path": "/books",
      "query": {
        "id": 1
      },
      "method": "GET"
    }
    ...
  },
  "url": "my-api.com"
}

Call APIs

api-test run my_first_test_case # Run single test case
api-test run all                # Run all test cases simultaneously

API Response

API Response

Add automated integration tests

Run the same tests in development, staging and production environment automatically.

In JSON file:

{
  "testCases": {
    "my_first_test_case": {
      "path": "/books",
      "query": {
        "id": 1
      },
      "method": "GET"
    },
    "expect": {
      "body": {
        "eq": {
          "id": "1",
          "author": "Robin Wieruch",
          "title": "The Road to React"
        },
        "contains": {
          "id": "1"
        },
        "hasKey": ["id", "author", "title"]
      }
    }
  },
  "url": "my-api.com"
}

Run automated test:

api-test test my_first_test_case

Result:

API automated testing

Compatible with CI Workflow

Integrate automated tests in CI workflow.

Error exit code on failure

Error exit code on failure