Creating consumer-driven Contract tests by synchronizing resources
You can opt to create consumer-driven Contract tests when you synchronize resources that you created in another application with HCL OneTest™ API. If you already have created tests in the other application for your system under test and you have defined schemas and roots for messages, you can use the synchronizing feature of HCL OneTest™ API to generate Contract tests, tests, and stubs that you can run on HCL OneTest™ API.
Before you begin
You must have completed the following tasks:
- Created tests for your system under test in another application. The tests must include messages that use a transport and you must have defined schemas and roots for the messages.
- Read the types of resources that you can synchronize with HCL OneTest™ API. See Adding a resource.
- Created a project. See Creating a project.
- Opened the Synchronization view in the Architectural School perspective in HCL OneTest™ API.
Procedure
- Click the Create Synchronization Source icon in the toolbar.
-
Perform the following steps in the
Create a new Synchronization Source dialog:
- Select any of the following actions that depends on the type of Contract testing you want to perform in HCL OneTest™ API:
-
Perform the following steps in the Generate Assets for
Operations dialog:
-
Perform the following steps in the Generate Assets for
Operations dialog:
Results
What to do next
You can perform the following tasks:
-
Verify whether the test is a Contract test by performing the following steps:
- Click the test in the Test Factory view to open the test steps in the Test Lab view.
- Click the Reply or
Subscribe action.The message is displayed in the Message Editor.
- Check if any of the message elements have a value as
Validate Against Contract.
If any of the message elements display this value, then the test created is a Contract 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.