Test Command

June 03, 20201 minute read

The test command is used to run automated integration tests on an API test case. To run an automated test, an expect object must be provided with the testing scenario in the test case file. See Test cases properties to view available properties and see Automated testing with api-test for writing integration tests.

$ api-test -f file.json test --help

Run automated tests for a test case.

USAGE: api-test [-v] -f file_name test [ARGS]

  -h (--help)           print this message

  all                   Run all automated tests.
  <test_case_name>      Run provided automated test.

'api-test -f test.json test test_case_1 test_case_2', 'api-test -f test.json test all'

The test command will exit with code 0 on successful test runs and exit with code 1 on failure.

Using the command

Call single API

Provide the test case you want to test.

api-test -f test.json test test_case_1

Call multiple APIs

You can provide multiple test cases as arguments.

api-test -f test.json test test_case_1 test_case_2 test_case_n

Call all APIs

To run all tests at once, pass all as the argument.

api-test -f test.json test all