Correlating Statements
The primary reasons for correlating statements are:
1. To simplify or optimize your code
2. To generate dynamic data
3. To accommodate unique data records
The main steps in correlating a script are:
- Determine which value to correlate:
For most protocols, you can view the problematic statements in the Execution log. You double-click an error message and jump directly to its location. Alternatively, you can use the WDiff utility distributed with VuGen to determine the inconsistencies within your script.
- Save the results.
You save the value of a query to a variable using the appropriate function. The correlating functions are protocol-specific. Correlation function names usually contain the string save_param, such as web_reg_save_param and lrs_save_param. Refer to the specific protocol chapters for an explanation on how to perform correlation. In several protocols, such as database and Web, VuGen automatically inserts the functions into your script.
- Reference the saved values.
Replace the constants in the query or statement with the saved variables
To correlate statements for protocols that do not have specific functions, you can use the C Vuser correlation functions. These functions can be used for all C-type Vusers, to save a string to a parameter and retrieve it when required.
lr_eval_string- Replaces all occurrences of a parameter with its current value.
lr_save_string- Saves a null-terminated string to a parameter.
lr_save_var- Saves a variable length string to a parameter.
If you need to perform arithmetical operations on aparameter, you must change it from a string to an integer using the atoi or atol C functions. After you modify the value as an integer, you must convert it back to a string to use the new variable in your script.
Comments
Post a Comment