Previous Topic: Add an Assertion from a JDBC Result SetNext Topic: Add an Assertion to a Mobile Test Step


Add an Assertion for Returned Java Object

When the test step returns a Java object, use the Complex Object Editor inline assertion panel to add an assertion on the returned value directly from the method call. The following example shows how to add an assertion this way.

This example uses the Get User (an EJB step) step in multi-tier-combo test case in the examples directory.

Follow these steps:

  1. Enter an input parameter itko, and execute the method call getUser. Then, execute the getPwd call on the UserState object that was returned from that call.

    Assertion: Adding an assertion from a returned Java object example screenshot

  2. To open the Status/Result pane where you can add the assertion, select the Expert Mode check box in the left pane.

    Assertion: Adding an assertion from a returned Java object example screenshot with Expert Mode check box selected.

    The returned value upon executing the getPwd method is stored in the property CurrentPassword.

  3. Add an assertion that tests if the returned value is equal to the string "test". If it is not that, then redirect to the Fail step.
  4. Click Execute to execute this step.

Note: Inline assertions (and filters) do not result in an assertion being added to the test step. Inline assertion management is always done in the Complex Object Editor.

For more details on the Complex Object Editor, see Complex Object Editor (COE) in Using CA Application Test.