This topic explains how to configure the SQL Responder tool, which virtualizes database responses to various queries. Responders are the core tools used in Parasoft Virtualize.
Sections include:
Table of Contents | ||
---|---|---|
|
...
To edit data stored in a Data Repository, click the Open in Table Editor button in the SQL Responder editor.
This opens the associated data repository editor—where editor where you can review and edit/extend the stored values. You can also open the data repository editor by double-clicking the appropriate SQL Data Sets node in the Data Repositories view.
...
- JDBC Connection URL (string): The name of the database recording you selected in the wizard.
- SQL Template (string): The SQL queries recorded. When the SQL Responder receives a query, it tries to match it against the set of available query templates. If a match is found, the correlated result set is used as a response.
- SQL Parameters (list of data set records): The parameters recorded for the above SQL queries (like values in WHERE clauses , etcand so on).
JDBC Connection URL and SQL Template are key columns (as indicated by the light purple coloring). The yellow coloring in the SQL Parameters column indicates that you can drill down into it.
SQL Parameters Table (Level 2)
...
If any parameters were associated with the recorded query (values in WHERE clauses, etc), additional columns will be added to allow you to view and edit related parameter values.
Result Set Table (Level 3)
From the SQL Parameters view, double-clicking a value in the Result Set column opens the Result Set table, which allows you to edit the values that will be used in a response.
...
EditingEditing
To review, edit, and extend the SQL templates, result sets, and associated parameters, use the data repository editor functionality, which is described in Viewing and Modifying the Repository Structure and Contents.
If you prefer to edit Result Set data in csv CSV format, you can export data, manipulate it in a csv CSV editor, then reimport the edited file.
To export Result Set data in CSV format:
...
, right-click the Result Set table
...
and choose Export to CSV.
To import the edited data,
...
right-click the Result Set table
...
and choose Import from CSV. Note that any existing entries in the repository will be overwritten upon import.
...
Best Practices
When editing or extending SQL data sets:
...
Editing Data Stored in a CSV File
The Queries panel will display show all the SQL queries recorded. For each SQL Query, there may be parameters (like values in WHERE clauses , etcand such). To see the result sets and parameters associated with a specific SQL query, select that query.
The result set files will display appear in the Parameter Criteria table.
To To edit the SQL templates, use the controls in the Queries panel. You can add or remove entries as needed.
To edit result sets and parameter criteria, first select the correlated query. The name of the associated CSV file will then display appear in the Parameter Criteria area. These CSV files are stored within the database_recorded_data
folder inside the VirtualAssets
project. To edit the result set values, edit those CSV files.
To edit parameters, modify them directly in the Parameter Criteria area.
...
For example, the following configuration is set to match the exact salary of 80,000 to one ResultSet file and the exact salary of 100,000 to another.
You You could use criteria expressions to match all salaries up to 80,000 to one ResultSet file, match all salaries between 80,000 and 100,00 to another, and match all salaries above 100,000 to a third ResultSet File. Or, you could use [*] in the SQL Template area to create a "catch all" for unmatched SQL queries.
...
You can modify the SQL Responder to reflect different database response times—for times, for instance, to reflect realistic database performance or to simulate how performance might vary under different con-ditions conditions (such as the size of database and tables, the number of tables used in executing the query, the existence of indexes, and server load).
If the SQL Responder is triggered to use a result set with an additional response delay, it will pause for the amount of time specified in the Additional Response Delay (ms) column—plus column, plus any additional time specified in the virtual asset’s performance profiles, which are described in Working with Performance Profiles—before , before it returns the result set. The The time specified in the Additional Response Delay (ms) column is a per-query delay. For example, if you specify a delay of 5000 ms here and two queries are executed, the additional delay will be 10,000 ms.
Note that additional response delays apply to all queries—including queries, including metadata queries.
Repository Data
...
If the data is stored in a CSV file, response time adjustments can be made by altering the Additional Response Delay (ms) column value in the Parameter Criteria panel.
Chaining Tools to the Responder’s SQL Query or Result or Result Set
You can chain tools to a SQL Responder’s incoming request (SQL Query) or outgoing response (Result Set) as follows:
- Right-click the Virtual Asset Explorer node to which you want to add this tool .Choose and choose Add Output.
- Select the desired output type on the left and the desired tool on the right. For example, if you want a custom tool to perform some action on the query, you would select Incoming Request> Request > SQL Query on the left, then the appropriate tool on the right.