Creating a project
Before you begin
About this task
After you launch HCL OneTest API, you must create a new project, provide a name for your project and save it on your local drive. The following instructions are applicable for the Windows OS.
Procedure
Results
The new project is created.
What to do next
Importing the Swagger definition of phonebook sample API from HCL Quality Server
Before you begin
You must have created a project as described in Creating a project. Your project must be open in HCL OneTest API.
About this task
You model a system under test against which you run tests. HCL Quality Server provides some sample APIs that you can use while working with HCL OneTest API. You can use one of these sample APIs as the system under test.
Procedure
Results
You have successfully created the Swagger definition in HCL OneTest API. The service components and operations are created in the background.
What to do next
Creating a test from the Swagger definition of the API
Before you begin
You must have imported the Swagger definition by following the steps in Importing the Swagger definition of phonebook sample API from HCL Quality Server.
Procedure
Results
You have configured a test based on the Swagger definition.
What to do next
You must run the test. See Running the test.
Running the test
Before you begin
You must have created the test following the steps in Creating a test from the Swagger definition of the API.
If any action editor (of the Send Request or Receive Reply action) is open, you must close it.
Procedure
Results
When your run the test, the test attempts to verify the response it receives from the API against the structure and data values that are contained in the test. Because you created the test by importing a Swagger definition, and Swagger definitions only contain message structure and not the actual data, the test has nothing to verify the response. Hence, the test fails.
What to do next
You can modify the test based on the response received. See Modifying the test by basing it on the response data.
Modifying the test by basing it on the response data
Before you begin
You must have run the test by following the steps in Running the test.
Procedure
Results
The test finishes successfully.
What to do next
Viewing messages and actions
Before you begin
You must have run the tests successfully by following the steps in Modifying the test by basing it on the response data.
About this task
You can view the messages received by the test and also view the messages that the test sends to the API being tested.
Procedure
Results
You have viewed the data that was exchanged in the test with the API under test. You can return to this action editor through the test editor in the Test Factory perspective at a later time without having run the test first.
What to do next
- Open the Test Factory perspective.
- In the tree on the left, right-click the queryPhonebook operation, and
click .
This action creates a new test for the operation and automatically creates request and response actions by using the information of the Message Exchange Pattern of the operation which was imported from the Swagger definition.
You must create stubs (virtual services) that can substitute the dependencies of your system under test. See Creating and running a stub.
To run tests as part of continuous integration or continuous delivery pipeline, see Run tests by using an Ant task.
To make the test more flexible in the number of entries it can receive and what data those entries can contain, you can use repeating elements and data sources. For details, see Repeating elements in messages.