Creating Transactional Web Tests for Visual Studio with Fiddler / neXpert

One of the best features of Fiddler when performance testing is it’s ability to save a capture as a Visual Studio Web Test.  You can then use this web test to functional test or stick it in a load test to stress test your site.

The latest version of Fiddler (2.2.2.0) has an updated “Save As Visual Studio Web Test” which will now use any steps you created with neXpert to automatically create transactions in the generated web test.

NOTE:  You may experience a bug with the think time not correctly being set on the resulting web test.  You can easily change the think time between requests through the Visual Studio GUI.  This will be fixed in a future version of Fiddler. (This note will be updated with the version it is fixed in)

If you have never checked out the original feature, please see the following resources:

This post will first go over the value of transactions and then provide a walkthrough of creating transactional web tests with Fiddler/neXpert

 

What is a Transaction?

“A transaction in a Web test is like a timer. You can encapsulate a set of actions in a transaction. You can think of a typical transaction as starting a timer, requesting a page, requesting another page, and then ending the timer. This series of actions, from start to end, constitutes a transaction.

When using Web tests in a load test, transaction response times are displayed in the transaction table of the Load Test Analyzer.” MSDN

So what does that mean exactly?  Transactions let you:

  • Name steps in a scenario
  • Associate requests together

All so you can get an accurate response time for each step of a common scenario.

 

Transactions in a Web Test

Lets look at some quick examples.  Say we want to script a web test of the neXpert blog.  Lets do the classic scenario of:

  1. Navigate to the blog
  2. Click on a post
  3. Click on the email link
  4. Click on the Known Issues page

Doing this using the VSTS recorder or Fiddler we get the following web test:

image

Running the test produces the following:

image

As you can see, each page is given it’s own timer.  This is fine for a simple site like the blog, but what about a more involved site like Facebook?

Lets look at the following simple Facebook scenario:

  1. Navigate to login page
  2. Log in
  3. Click profile

Even though there are only 3 steps, there are 10 steps recorded by VSTS to complete the scenario

image

Running the web test also shows the time and statistics for all 10 (Not aggregates of the 3 steps we are interested in):

 image

Here is where the power of transactions comes in.  Wrapping the appropriate steps in transactions now produces the following web test:

image

And running the web test produces the following chart:

image

Much better!

 

Transactions in a Load Test

Not only does this help with a single web test, it also helps with load testing.  Now you can view results by transaction after a load test is finished.  Facebook was “load tested” with 1 user for 30 sec.

The following is a snippet from the Load Test Summary provided at the end of a load test run.

image

 

Creating Transactional Web Tests with Fiddler/neXpert

Now that I have convinced you to use transactions, lets walk through how to use Fiddler/neXpert to create transactional web tests.

Step 1: Capture with Fiddler adding neXpert step markers along the way

Here is a screenshot of running through a typical scenario of someone visiting the neXpert blog.  Notice the step names marked in the “Step" column.image

Step 2: Save as Visual Studio Web Test

Highlight all the session you wish to create a web test from, then select Save… Selected Sessions… as Visual Studio Web Test from the File menu.

image

Step 3: Create a new Test Project

In Visual Studio, create a new Test Project which will hold the web test.

image

Step 4: Add web test to project

Right click on the project name and choose Add … Existing Item.

image

Navigate to your saved web test.  Be sure to change the filter to the right of the File name box to “Web Test Files”

image

You should now see your web test in the project in the Solution Explorer.

image

Step 5: Run the test

Double clicking on the web test in the Solution Explorer will allow you to configure the web test.  As you can see, the step names in neXpert were used to create the name of each transaction.

image

image