OAS:OpenAPI Editor/OpenAPI Test/Requests/Manage Tests
Contents
- 1 Managing Tests
- 1.1 Test Structure
- 1.2 Create TestSuite
- 1.3 Rename TestSuite
- 1.4 Delete TestSuite
- 1.5 Create TestCase
- 1.6 Rename TestCase
- 1.7 Delete TestCase
- 1.8 Edit TestCase
- 1.9 Run TestCase
- 1.10 Add Assertion to TestCase
- 1.11 Run TestCase with Assertion
- 1.12 Delete Assertion
- 1.13 Run Collected TestCases on TestSuite
- 1.14 Run all Test Cases from Test Suites Node
Managing Tests
Test Structure
OpenAPI Test structures functional tests into three levels; TestSuites, TestCases, and Assertions.
- TestSuite is a collection of TestCases that can be used for grouping functional tests into logical units.
- TestCase is a request method that can contain a collection of Assertions. You can add any number of TestCases to a containing TestSuite.
- Assertions are pre-defined variables with values that can be asserted on the request-response to ensure that a request is working as expected.
Create TestSuite
Select Test Suites node from the definitions view > right mouse-click and click on New Test Suite > enter the test suite name on the displayed dialog and click on OK. The created test suite will be displayed as a child of the test suites node.
Rename TestSuite
Select a test suite > right mouse-click and click on Rename > enter the name of the test suite and click on Ok.
Delete TestSuite
Select a test suite > right mouse-click and click on Delete > Klick on Ok.
Create TestCase
Select a method from a request node > right-mouse-click and click on New Test Case > new test case dialog will be displayed.
The following test case dialog will create and add the test case to the selected test suite.
Enter the name of the test case and select an existing test suite > click on Finish. The created test case will be displayed as a child of the test suite.
The following test case dialog will create a test case and a test suite. To create a test suite enter the name of the test suite, then click on Create button. Enter the name of the test case and click on Finish, the test case will be created and added to the test suite.
Rename TestCase
Select a test case > right mouse-click and click on Rename > enter the name of the test case and click on Ok.
Delete TestCase
Select a test case> right mouse-click and click on Delete > Klick on Ok.
Edit TestCase
Select a test case > right mouse-click > click on Edit > the editor will be opened on the right site. In our example, we want to change the pet name, to do that you have to select the body view and change the name of the pet e.g to parrots and save the changes.
Run TestCase
Select a test case > right mouse-click > click on Run > The output will be displayed in the Request Test view.
Add Assertion to TestCase
Select a test case > right mouse-click > click on Add Assertion > The assertion wizard will be displayed > select the response assertion > enter the assertion condition and value > click on Finish. The added assertion will be displayed as a child of the test case.
As you can see in the wizard the following assertion types can be added:
- Response body
- Response headers
- Response status code
- Response status text
- Response time
Run TestCase with Assertion
This test checks the response body of the request. If the response body contains the string parrots, the test will pass, otherwise, it will fail. Run the test case again > the following output will be displayed:
Delete Assertion
Select an assertion > right mouse-click and click on Delete > Klick on Ok.
Run Collected TestCases on TestSuite
Select a test suite that contains test cases > right mouse-click and click on Run.
Run all Test Cases from Test Suites Node
Select Test Suites node > right mouse-click and click on Run.