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 Test Integrations and APIs. 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 Test Integrations and APIs to generate Contract tests, tests, and stubs that you can run on Test Integrations and APIs.
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 Test Integrations and APIs. See Adding a resource.
- Created a project. See Creating a project.
- Opened the Synchronization view in the Architectural School perspective in Test Integrations and APIs.
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 Test Integrations and APIs:
-
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.