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:


  1. Select the operation or folder in which you want to create the test.
  2. Right-click the operation or folder and select New > Contract Tests > Consumer 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 New > Contract Tests > Consumer.
  3. 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.


You have created a Contract test under an operation in the Test Factory view and the test includes the appropriate messaging actions as defined by the operations MEP.

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 Image of the Run icon..
    • Select the Contract test, and then click the Run icon Image of the Run icon. in the toolbar.
  • View in the console log, after the test runs that the incoming messages are validated against the contract.