Open topic with navigation
The primary reasons for correlating statements are:
to simplify or optimize your code
For example, if you perform a series of dependent queries one after another, your code may become very long. To reduce the size of the code, you can nest the queries, but then you lose precision and the code becomes complex and difficult to understand. Correlating the statements enables you to link queries without nesting.
for dynamic data
Many applications and Web sites identify a session by the current date and time. If you try to replay a script, it will fail, because the current time is different than the recorded time. Correlating the data enables you to save the dynamic data and use it throughout the scenario run.
to accommodate unique data records
Certain database applications require the use of unique values. A value which was unique during recording is no longer unique for script execution. For example, suppose you record the process of opening a new bank account. Each new account is assigned a unique number which is unknown to the user. This account number is inserted into a table with a unique key constraint during recording. If you try to run the script as recorded, it will try to create an account with the recorded number, rather than a new unique number. An error will result because the account number already exists.
If you encounter an error when running your script, examine the script at the point where the error occurred. In many cases, a correlated query will solve the problem, by enabling you to use the results of one statement as input to another.
For additional information, see the Virtual User Generator User Guide.