Creating a single Contract test
You can create a single Contract test from a Message Exchange Pattern (MEP) in HCL OneTest™ API from the Test Factory view. The MEP defines the pattern, schema, and binding for messages that are exchanged by the operation. You can create a Contract test that adheres to the rules defined in the contract.
Before you begin
You must have completed the following tasks:
- Created a project. See Creating a project.
- Created a logical resource and bound it to its corresponding type of physical resource.
- Created a service component under the logical resource. See Creating a service component.
- Created an operation under the service component. See Creating an operation.
- Added a schema that is used to validate the incoming messages. See Adding a schema.
- Configured the MEP for the operation. See Configuring the MEP settings to create consumer-driven Contract tests.
- Opened the project in the Test Factory view.
Procedure
- Select the operation or folder in which you want to create the test.
-
Right-click the operation or folder and select
from the menu.Note: If you created a test already, you can right-click the Tests folder or one of the existing tests, and then select .
-
Provide a name for the new test when prompted, and then click
OK.
A Contract test with the name that you provided is created under the operation.
Results
What to do next
You can perform the following tasks:
- Edit the test actions or other contents of the test, if required. See Changing the contents of a test.
- Run the Contract test in any of the following methods:
- Right-click the Contract test, and then click the Run icon .
- Select the Contract test, and then click the Run icon in the toolbar.
- View in the console log, after the test runs that the incoming messages are validated against the contract.