![Previous Topic: Add an Assertion from an HTTP Response](574.png)
![Next Topic: Add an Assertion for Returned Java Object](573.png)
Using CA Application Test › Using the Workstation and Console with CA Application Test › Building Test Cases › Assertions › Add an Assertion › Add an Assertion from a JDBC Result Set
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:
- 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](2145167.png)
- To run the query, click the Test/Execute SQL button.
- 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](2145168.png)
- Click
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.
- 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](2145170.png)
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](2145173.png)
Note: The same assertion capabilities are available when a JDBC result set is displayed in the step editor.
Copyright © 2014 CA Technologies.
All rights reserved.
![Previous Topic: Add an Assertion from an HTTP Response](574.png) ![Next Topic: Add an Assertion for Returned Java Object](573.png)
|
|