Previous Topic: Add an Assertion ManuallyNext Topic: Add an Assertion from a JDBC Result Set


Add an Assertion from an HTTP Response

When you have access to the response from an HTTP-based step, you can use the response to add an assertion directly.

This example of the HTTP/HTML response uses the login step in the multi-tier-combo test case. The point of this example is to test whether the text "MyMoney Home" appears in the response.

Follow these steps:

  1. Run the multi-tier-combo test case in the ITR.
  2. Double-click the Login step in the model editor.

    Screenshot of multi-tier-combo with LISA Bank Login step opened

  3. Select the text "MyMoney Home" in the View tab.
  4. To view and verify that this text is selected in the tree, click the DOM Tree tab.

    Screenshot of multi-tier-combo with LISA Bank Login step opened in DOM Tree view

  5. From the Select a Command pull-down menu at the bottom of the panel, select Make Assert on Selection.

    Screenshot of multi-tier-combo with LISA Bank Login step opened in DOM Tree view and Command menu opened

  6. In the displayed window, enter the expression that you expect the selected text to match, then select the appropriate assertion behavior.

    Assert Info dialog

    In this example, the assertion fires if the text "MyMoney Home" is not present, and then redirects to the fail step.

  7. Click OK to save the assertion.

    The assertion that was generated appears in the login step.

    Screenshot of Result as String Contains Given String assertion

 

Running one Filter and one Assertion

Alternatively, if you wanted a filter to capture the value "MyMoney Home," and run it as an assertion, use the Parse Value filter.

Filter: Create the filter from the HTTP/HTML request step response page

The HTML/XML Filter Info window shows that the Property Key value is the filter to apply and Expression is the assertion to fire.

Filter: HTML/XML Filter Info dialog to enter Property Key

As a result, one filter and one assertion are added to the login step and appear n in the model editor.

Note: The same assertion capabilities are available when an HTML response is displayed in the step editor.