Creating a test case
The following instructions show you how to create a test case using the API Manager.
-
Log in to the API Manager.
-
On the Home page, click the Test APIs tile.
-
On the Test page, select a test suite.
-
In the Create Test page, go to the Tests > Test Cases tab, and click Add.
-
Select a test case creation method:
- From spec (build with smart generation): Generates a complete test case that leverages NLP to help developers and QAs test their APIs effectively in an efficient way
- From Specification: Builds test case from OpenAPI specification
- From API Endpoint: Generates test case from a specified endpoint
- From scratch: Creates a test case with your own request and test conditions
-
If you selected From spec (build with smart generation), click Next, then perform one of the following steps:
- Go to the Existing APIs tab:
- Select a predefined API.
- Click Next.
- Select a path.
- Enter the API name.
- Provide a brief description.
- Add tags.
- Click Next. You will see the message that the test case has been generated.
- Click Edit. You will see the generated test assertions. You may edit the test assertions as needed.
- Click Save.
- Click Run Test.
- Go to the Import tab, do one of the following:
- Drag and drop a JSON or YAML file that has the API test case definition OR
- Enter an URL for the API test case. Provide username, and password if required, for authentication.
- Click Next.
- Select a path.
- Enter the API name.
- Provide a brief description.
- Add tags.
- Click Next. You will see the message that the test case has been generated.
- Click Edit. You will see the generated test assertions. You may edit the test assertions as needed.
- Click Save.
- Click Run Test.
- Go to the Existing APIs tab:
-
If you selected From specification, click Next, then perform one of the following steps:
- Go to the Existing APIs tab:
- Select a predefined API.
- Click Next.
- Select a path.
- Enter the API name.
- Provide a brief description.
- Add tags.
- Click Next. You will see the message that the test case has been generated.
- Click Edit. You will see the generated test assertions. You may edit the test assertions as needed.
- Click Save.
- Click Run Test.
- Go to the Import tab, do one of the following:
- Drag and drop a JSON or YAML file that has the API test case definition OR
- Enter an URL for the API test case. Provide username, and password if required, for authentication.
- Click Next.
- Select a path.
- Enter the API name.
- Provide a brief description.
- Add tags.
- Click Next. You will see the message that the test case has been generated.
- Click Edit. You will see the generated test assertions. You may edit the test assertions as needed.
- Click Save.
- Click Run Test.
- Go to the Existing APIs tab:
-
If you selected From API Endpoint, click Next, then perform the following steps:
- In the Request section, select a method, enter the API endpoint that was generated when you published the API, set the authorization if required, and click Send. You will see the response in the Response section.
- Click Next.
- Enter the test name, description, and tags, then click Next. You will see the message that the test case has been generated.
- Click Edit. You will see the generated test assertions. You may edit the test assertions as needed.
- Click Save.
- Click Run Test.
-
If you selected From scratch, click Next, then perform the following steps:
- Enter the test name.
- Provide a brief description.
- Add tags.
- Click Next. You will see the message that the test case has been generated.
- Click Edit.
- Enter the API definition. Refer to the Test Defintion Syntax for a sample.
- Click Save.
- Click Run Test.
What to do next
- Next topic: Modifying a test case