Creating tests with the Publish MEP

You can use the publish messaging pattern in your tests. You can send a message as the publish action in HCL OneTest API tests, by using an email account configured for the sender in your project to an email account configured as the recipient.

Before you begin

You must have configured the email accounts for the Publish MEP. See Configuring the MEP settings for the email transport.

You must have created an operation and opened the operation in the Test Factory view to perform this task.

Procedure

  1. Create a test that uses MEP by right-clicking the operation and selecting New > Tests > Tests using MEP.
  2. Enter a name for the test and then click OK.

    For example, the name fo the test can be Test_Publish.

    The test is created in the operation. Because the MEP for the Publish action was configured, the test is created with the settings configured in the MEP tab for an operation for the Publish action. The transport that was set in the MEP tab for the operation is selected.

    For example, the Publish action is displayed in the Test Factory for the email resource that shows the schema as text and the email resource as the transport resource.Image of the publish action in the test.
  3. Select your action from the following options:
    • You can run the test with the parameters configured for the MEP. Go to Step 5.
    • You can modify any of the parameters in the test before you run it or if you have duplicated the operation and want to run a different test by modifying the parameters copied, go to Step 4.
  4. Modify any of the settings that you want to specify in the test by completing the following steps:

    The MEP settings that you configured in the MEP tab for the operation are displayed.

    1. Double-click the Publish test step.
      The Publish window is displayed with the settings that you configured in the MEP tab for the operation.Image of the Publish test step window.
    2. Modify any of the following parameters for the transport or the message headers:
      • The email transport.
      • The text in the Subject field.
      • The email address of the recipients in the To field.
      • The email address of the sender in the From field.
      • The email address of the recipients to whom a reply message is to be sent in the Reply To field.
      • Add or change the email address of recipients to whom a copy of the message is to be delivered in the CC field.
      • Add or change the text to be included in the body of the message.
  5. Run the test.

Results

You have created and run a test that uses the Publish messaging pattern.