Advanced capability in Web Performance Test of VS2010

Suppose you have a very stupid web page that adds two numbers together.

SNAGHTML1bfcde2

Figure 1: A stupid web page to sum two numbers

WOW, this is really a beautiful and useful web page :), now I want to register a web performance test that is able to use extraction rules to use this page as a Fibonacci Number calculator. I start registering a simple web performance test that adds 1 and 2 together. This is a simple two steps web performance test.

SNAGHTML1e449c5

Figure 2: recorded web performance test with two simple pages.

Now execute the test in Visual Studio, then go to request tab, localize the txtB parameter and press right click and then Quick Find. Now in the Quick find windows press find next  to quickly localize the position of the input textbox in the response of the second request. This permits you to immediately localize where the page render the text.

SNAGHTML1e8ee2e

Figure 3: With quick find I can localize with easy values of the request

Now select the value 2 in the response text, right click and then select Add Extraction Rule, repeat the same with the value 3 of the lblResult label. Now the test contains two extraction parameters called param0 and param1, just rename them to give them more meaningful names.

SNAGHTML1ec858d

Figure 4: Rename extracted parameter to some more meaningful names.

Now select the second request in the test and copy with CTRL+C and CTRL+V, now edit the form post parameter setting the txtA parameter to context parameter B and txtB field value to context parameter result. Remember that for Fibonacci numbers you can grab the next number in the series just adding the last two numbers (B and result of the previous request).

SNAGHTML1f11751

Figure 5: copy the second request and use the context parameter extracted in the previous request

Now right click the request, and choose Insert Loop, simply select a For Loop and setup the loop to do 10 iterations.

SNAGHTML1f37bfc

Figure 6: A loop is added to the request, now the copied request will be executed 10 times.

Now execute the test, and with few clicks of the mouse you have created a test that calculates fibonacci numbers.

SNAGHTML1f5441b

Figure 7: The fibonacci number calculator web performance test in action.

This example is really not so useful, but demonstrates how you can create a complex web automation test, with loops and requests that depends on the previous response, thanks to extraction rules.

Alk.