The data correlation algorithms that are used during test generation are based on well known best practices. However, because these practices continually evolve, various types of errors can occur during automated data correlation:
When two parameters that must be correlated have different names, automated data correlation does not recognize that the two parameters are related. For example, consider this request: http://madeupsite.ibm.com?id=12345. Suppose that this request must be correlated with the server response that contains customer_id=12345, not id=12345. In this case, the id parameter must be correlated with customer_id.
Data correlation typically links a response value that was returned from the server with a subsequent request value. The automated correlation algorithms search in the URL and the POST data for potential matches; however, other schemes for returning parameters are possible. For example, consider this request: http://madeupsite.ibm.com?id=12345. Suppose that this request must be correlated with the server response that contains the name and entity pair href name="customer_id" entity="12345", not id=12345. In this case, the id parameter must be correlated with name="customer_id" and value 12345 must be correlated with entity="12345".
Sometimes a parameter or value must be correlated with a previous parameter or value that is not named in the test, because it is computed, for example, by a JavaScript™ program. In this case, in order to correctly correlate the data, you must understand how and where the parameter or value is computed, and then use a custom code block. See Extending test execution with custom code for more information about custom code.
For example, consider the Web address http://www.madeupsite.com?login_stamp=12345_Apr_11_07, where the value for login_timestamp is the concatenation of the login ID and the current date. In this case, you need custom code that concatenates the login ID and the date.
For another example, suppose that the server returned the login ID and date as separate entities: href "customer_id=12345" Date="Apr_11_07". In this case, you can put these parameters in separate references and, in subsequent requests that use customer ID and date, substitute them separately.
Automated data correlation is based on pattern matching: a parameter or parameter value is correlated with a subsequent parameter or parameter value with an exact or similar name. But sometimes parameters with exact or similar names are in fact unrelated. In the best case, unneeded correlation is either harmless or adds a slight load that is inappropriate. In the worst case, the application does not expect a correlation and fails during playback.
A parameter that requires data correlation might occur many times throughout a test. For example, a session ID parameter that is used initially when a user logs in might also be used in every subsequent request. If multiple instances of a parameter in a test are not same, the correlation algorithms might use the wrong instance.