Applies to ReadyAPI 2.2, last modified on November 17, 2017

Assertions are validation rules applied to test results that check how your target web service performs.

Let's create an assertion that will check that the target web service responds within a time limit:

  • Switch to the initially created request.

    Getting Started With SoapUI: Assertions Tab

    Click the image to enlarge it.

  • Expand the Assertions tab and click Add Assertion.

    Getting Started With SoapUI: Add Assertion Button

    Click the image to enlarge it.

  • In the Add Assertion dialog, select SLA > Response SLA and click Add.

    Getting Started With SoapUI: Add Assertion Dialog

    Click the image to enlarge it.

  • Specify the maximum expected response time and click OK.

    Getting Started With SoapUI: Response SLA Assertion

    Now, if the test step takes longer than the specified number of milliseconds to complete, the assertion will trigger, and the test will fail.

Let's also verify that the returned location is consistent:

  • Expand the Assertions tab and click again.

  • In the Add Assertion dialog, select Property Content > XPath match and click Add.

    Getting Started With SoapUI: XPath Match Assertion

    Click the image to enlarge it.

  • Click to select an XML node from the response.

    Getting Started With SoapUI: Creating XPath

    Click the image to enlarge it.

  • Select geometry[1]/location[1]/lat[1] and click OK.

    Getting Started With SoapUI: Creating XPath
  • SoapUI will create the XPath expression to access the response item, and set the result from the last response as the expected result. Click Save to create the assertion.

    Getting Started With SoapUI:

    Click the image to enlarge it.

Now, if the response changes, the assertion will trigger and the test step will fail.

Prev     Next

See Also

About Assertions