Previous Topic: Add an Assertion from an HTTP ResponseNext Topic: Add an Assertion for Returned Java Object


Add an Assertion from a JDBC Result Set

When you have access to the Result Set response from a JDBC step, you can use the response to add an assertion directly. The following example shows how to add an assertion in this way.

Here is an example for a result set response, using the response of Verify User Added step in multi-tier-combo test case in the examples directory (multi-tier-combo.tst).

Follow these steps:

  1. Select the Verify User Added step, and double-click it to open its editor window. Edit the SQL statement so it reads select * from users.

    Assertion: Screenshot of adding an SQL statement to the Verify User Added step

  2. To run the query, click the Test/Execute SQL button.
  3. Select the Result Set tab and click the cell in the result set that represents the information that you want to test for (for example, sbellum).

    Screenshot of Result Set tab with cell highlighted to add an assertion from a JDBC Result Set

  4. Click Icon - blue page with arrow to white page Generate Assertions for the Value of a Cell in the toolbar below the Result set window.

    We want to test that sbellum appears in a cell in the LOGIN column.

  5. In the Generate JDBC Result Set Value Assertion dialog, enter the test step (fail) to redirect if the value is not found:

    Generate JDBC Result Set Value Assertion

    DevTest creates an assertion with the name Ensure JDBC Result Set Contains Expression in the Verify User Added step.

    Assertion: Adding an assertion from a JDBC Result Set showing assertion added

Note: The same assertion capabilities are available when a JDBC result set is displayed in the step editor.