Validating Database Values

In this use case, a test executes an action that modifies a database. The goal of this use case is to validate that the resulting values in the database are correct.

The following table shows a typical flow for a Web Services of the script. You can use a similar validation for other protocols.

API function
Connect to database
lr_db_connect (in vuser_init section)
Web Service call
Execute an SQL query
Retrieve and save the data
lr_db_getvalue to <param_name>
Check the data
Disconnect from database
lr_db_disconnect (in vuser_end section)

For more information, see the Function Reference.

The following example illustrates this process of checking the data:

/* A Web Service call that modifies a database on the back end. */
    web_service_call( "StepName=addAddr_102",
/* Query the database by the cusotmer name that was modified by the Web Service*/
        "SQLQuery=SELECT * FROM Addresses WHERE name = '{Customers}' ", 
/* Get the values retrieved by the database query. */
/* Compare the actual value with the expected value stored in the database. */
return 0;

Back to top