This post will give you an overview of the new Correlation Helper feature in the Orcas release of Visual Studio. First, what do I mean by correlation? Correlation is the process of replacing the hard coded values of dynamic parameters with an extracted value from a previous request. For example, suppose that you are recording a site that has a query string variable called sessionId. After recording, this parameter will be hardcoded to the value that was used during the recording. As soon as this session is no longer active, the web test will fail during playback.
So how do you fix the test? Typically the dynamic parameter will appear in the response of a previous request. So first you would have to add an extraction rule to the request that has the new value. Then you would replace each hard coded instance with the value pulled from the extraction rule. This process can take a while if you have multiple dynamic parameters. Check out this blog post which goes over this process in detail: Debug a Web Test post It is useful to quickly look over this post to see what the current process is. The good news is that for many cases, we are going to reduce this process to one click on a dialog.
What is the new process? We have added a feature which will attempt to detect dynamic parameters and then automatically fix up your web test. By fix up, I mean add the extraction rules to the appropriate requests and replace the hardcoded parameters where needed. The correlation helper will run when you click stop on the web test recorder. You will also be able to launch this from the web test editor toolbar. After going through the detection process, it will present you with a list of parameters that it believes are dynamic. You then select which parameters you would like the tool to correlate for you and then select Ok. That’s it. You can also check out this blog post from Ed Glas which discusses this feature: Web Test Correlation
I will now walk you through how this works. I am going to use the same web test from the Debug a Web Test post so you can see how easy this process has become with the correlation helper.
1. First I am going to record my web test which records me viewing reports on a SQL Server Reporting Services site.
2. When I click stop, you will automatically see the following dialog. This is what will appear while the correlation detection process is running.
3. When the detection process is complete, you will be presented with the following dialog, which lists parameters that are flagged as being dynamic parameters. For this test, the process has detected 7 parameters. The main thing to notice is that up to this point, you have done nothing different. This process happened automatically after you stopped recording.
4. Notice that as I click on a row, 2 requests in the web test are highlighted. The first request will be the request that the extraction rule is added to. The second request is the one that currently has a hardcoded parameter that will be replaced with the value from the extraction rule.
5. When you click Ok, the test will be modified and the correlation process is complete. One thing to notice is that parameters now have a read only property called recorded value. So if at any time, you wanted to revert to the recorded value, you can click on the parameter and see the recorded value in the property grid. Here is the image of the final web test. Notice the extraction rules which have been added.
Hopefully you will find this feature extremely useful. I suspect it will make the web test recording process much smoother. This feature will be available in the beta 2 release.