Testing APIs

EngageIP contains tools for testing API workflows. API tests allow developers to create a series of calls for common integration tasks.

Test Groups

A test group is the container for a series of API calls. Test groups are made of one or more test cases. Groups may also contain variables that are accessible to all test cases in the group.

Test Cases

A test case is a single API call that make up the series of calls. You must create a unique test case for each unique call. If a call requires a parameter (such as PUT, DELETE, etc.), a variable may be used to store the ID from a POST to be used in later test cases. Test cases allow you to define the header and body of the request. You may also create individual tests and dependencies for each test case.

Variables

Variables can be used for data in test cases. Variables can be extended to include a list of properties that are key/value pairs. A common use case would be to use the response object from a POST to get the identity of the newly created object. This identity could then be used in a subsequent test case, for example, a PATCH or PUT which requires the id.

Variables are defined and initialized at the test group level. They can be used and set by all test cases within the group. If you wish to update a variable you can use the following sources:

    Variables can be used as parameters in an API call or to compare with a response object in a test.

    Tests

    Tests allow you to compare the response body to the request body, a variable, or a literal using a comparison operator. A common scenario may be to compare the response status to an expected status. If a test fails, the test case will be deemed a failure. It may be that some test cases are dependent on other use cases passing.

    Dependencies

    If you are testing an update API it might be necessary to create a dependency on test case that creates the object. Dependencies allow you to demarcate a test case as requiring another test case to have run successfully. If a test case listed as a dependency has not passed the dependent test case will not be executed.