Configuring the MEP settings to create consumer-driven Contract tests

You can configure the message exchange pattern (MEP) for an operation in Test Integrations and APIs so that you can create Contract tests for the application based on the MEP settings that you configure.

Before you begin

You must have completed the following tasks:

About this task

When you want to create a Contract test by using MEP in Test Integrations and APIs, the test can contain any of the following messaging actions:
  • Publish/Subscribe
  • Request/Reply
Depending on the messaging action that you want to test, you can select the action by using the settings on the Message Exchange Pattern tab.
Important: The MEP settings that you configure are used in the messaging action in the Contract tests that you create in the Test Factory view. You can either use the same configuration or modify the settings before you run the tests.

You must specify the schema and root for the schema, which is used to validate the schema in incoming messages with the schema in the expected message, and then validates the contract as adhered when both the schemas match.

You can configure the MEP settings of the operation that you created for the logical resource from the Logical View.

Procedure

  1. Double-click the operation to open the Operation dialog.
  2. Click the Message Exchange Pattern tab, if it is not already open.
  3. Select the messaging pattern that you want to use in your tests from the list in the Pattern field.
    You can select from the following options for the MEP that are listed for selection in the Pattern field:
    • Request/Reply
    • Publish/Subscribe
    For example, you can select the Request/Reply MEP.
    image of the MEP tab of the operation.
  4. Complete the following steps in the Schema panel:
    1. Click Browse to select the schema and root for the schema for the outgoing messages for the Request or Publish pattern.

      For example, you can select the schema that you added for the Request pattern.

      The Select Schema dialog is displayed.
      Image of the Select Schema dialog.
    2. Select the schema that you want to use for the outgoing messages.
    3. Select a root for the schema by expanding the list in the Roots panel, and then select the root for the schema for the outgoing messages.
    4. Click Finish.
    5. Click Browse to select the schema and root for the schema for the incoming messages for the Reply or Subscribe pattern.

      For example, you can select the schema that you added for the Reply pattern.

      The Select Schema dialog is displayed.
      Image of the Select Schema dialog.
    6. Select the schema that you want to use for the incoming messages.
    7. Select a root for the schema by expanding the list in the Roots panel, and then select the root for the schema for the incoming messages.
    8. Click Finish.
  5. Complete the following steps in the Bindings panel:
    1. Click Browse to select the physical transport and perform the following steps:
      1. Select the physical resource as the required transport in the Select a Resource dialog box.
        Refer to the following table for the options and the action you can take:
        Option Action
        No If you select No, you can select any transport in the project.
        Yes If you select Yes, you can select only transports that are referenced (directly or indirectly) by the operation that contains the test.
        Only Direct If you select Only Direct, you can select only transports that are referenced directly by the operation that contains the test.
      2. Click OK in the Select a Resource dialog box.
    2. Select the type of the message from the Message Type list.
    3. Configure the message properties for the messaging pattern.

      The options that are displayed are based on the type of transport that you select.

  6. Click OK to save the MEP settings and exit from the Operation settings dialog.

Results

You have configured the MEP settings for an operation.

What to do next

You can create the following types of Contract tests in the Test Factory view that use the MEP settings configured for the messages: