Message Content Assertion

Applies to ReadyAPI 3.56, last modified on November 21, 2024
The Message Content assertion has been superseded by the Smart Assertion as of ReadyAPI 3.9.0. The assertions will continue to be available, but we recommend transitioning to Smart Assertions.

The Message Content assertion checks the content of messages and properties in accordance with the predefined set of rules.

To use this assertion, you need a ReadyAPI Test Pro license. If you do not have it, request it on our web site or start a trial.

Availability

This assertion is available in multiple ReadyAPI applications. Depending on the application, it validates the following data:

In... Checks... To learn more...
Functional tests The request or response contents. See Working With Assertions in Functional Tests.
Security tests The response contents. See Security Assertions.
Virtual services The request contents. See Assertions in Virtual Services.

Create an assertion

Follow these steps:

Functional test: The Assertions panel

Click the image to enlarge it.

  1. Open a test step.

  2. Click Add assertion.

In the New Assertions dialog, search for the Message Content assertion or select it manually in the Property Content category.

Follow these steps:

Security tests: The Assertions panel

Click the image to enlarge it.

  1. Open a security test.

  2. Click Response Assertion next to any scan.

  3. Click in the Assertions panel

In the New Assertions dialog, search for the Message Content assertion or select it manually in the Property Content category.

Follow these steps:

Virtual service: The Assertions panel

Click the image to enlarge it.

  1. Open a virtual service.

  2. Open the Assertions drop-down panel.

  3. Click in the Assertions panel

In the New Assertions dialog, search for the Message Content assertion or select it manually in the Property Content category.

Setting up properties

Send the request at least once, to be able to parse the message.

When you add the assertion, ReadyAPI sets the default settings for it. If you are satisfied with the setting, click Save. Otherwise, change the assertion settings:

ReadyAPI: Configuring the Message Content assertion

Click the image to enlarge it.

  1. Select the check box next to the node you want to verify.
    ReadyAPI will add the AND operator between the nodes.

  2. Select the comparison operator from the matching drop-down list.

  3. Specify the value you need in the Expected Value column.

If needed, click Reconfigure to reload the values from the last response you have got.

To remove all the selected operators and the expected values, click Clear.

Comparison operators

The assertion uses the following comparison operators:

Operator Description
= Checks whether the actual node value equals the expected value.
!= Checks whether the actual node value does not equal the expected value.
> Checks whether the actual node value is greater than the expected value. For non-numeric values it always fails.
< Checks whether the actual node value is less than the expected value. For non-numeric values it always fails.
>= Checks whether the actual node value is not less than the expected value. For non-numeric values it always fails.
<= Checks whether the actual node value is not greater than the expected value. For non-numeric values it always fails.
exist Checks whether a node exists in the received message.
not exist Checks whether a node does not exist in the received message.
contains Checks whether a node contains the expected value. Case-sensitive.
not contains Checks whether a node does not contain the expected value. Case-sensitive.
regex Checks whether the actual value matches the specified regular expression.

Other assertions for content

Add more assertions for response and request contents:

See Also

Smart Assertion
Property Content Assertions
Contains Assertion
Not Contains Assertion

Highlight search results