How to extend Visual Studio 2010 Web- and Load-Testing with Transactional Tracing

Microsoft recently published the first official beta build of Visual Studio 2010. Visual Studio Team System for Testers has some nice improvements on their testing features. Additionally to new features – Microsoft also opened their extension points. One new interface that I am using to integrate Dynatrace into Visual Studio is the LoadTestPackageExt object and the ability to add new tabs to the WebTestResultViewer.

Providing your own tab in the Web Test Result Viewer

Extended Web Test Result Viewer
Extended Web Test Result Viewer

The image above shows a new Dynatrace tab that is added to the Result Viewer. Everytime the selection changes in the Result Tree – all tabs get a notification with the current selection context including the Web Reqest and Web Response. In my case I check the Web Response headers for the tagged Dynatrace Header. This header indicates that Dynatrace has captured a PurePath for the request. The header value also uniquely identifies the captured PurePath. My tab control hosts a Browser Control – displaying HTML that contains links all PurePaths of the currently selected request (there could be more than one PurePath because embedded requests may also result in a PurePath). With the new open Dynatrace RESTful APIs I can then just simply open the PurePath in the Dynatrace Client by sending an HTTP GET Request. (I will cover the RESTful Service APIs in a separate blog as I think this will be beneficial for many Dynatrace users).

Steps to implement your own custom tab?

Step 1: Create a Visual Studio Add-In

Just create a new Visual Studio Add-In Project. The Project Wizard will create a working Add-In.

Step 2: Reference Microsoft.VisualStudio.QualityTools. assemblies

Reference the following assemblies:

  • Microsoft.VisualStudio.QualityTools. LoadTestPackage
  • Microsoft.VisualStudio.QualityTools. LoadTestFramework
  • Microsoft.VisualStudio.QualityTools. WebTestFramework

Step 3: Work with the LoadTestPackageExt object to register callbacks

In the OnConnection method of your Add-In you can register the callbacks in order to create and dispose your tab controls. In case your Add-In gets activated when a Result View is already opened – you can also iterate through the currently opened Result Windows.

OnConnection Implementation
OnConnection Implementation

Step 4: Create your tab control and add it to the Result Viewer

Implement a Create method that creates the new control and adds the control to the result viewer tab. Also – keep track of created controls and which test result is displayed. At the SelectionChange event handler you only want to update the control in the Test Result View that had the selection change. This is necessary because multiple result viewers can be open at the same time displaying different test run results.

Create control and add tab
Create control and add tab

Step 5: Implement your event handlers

The event handlers take care of triggering the tab creating, notifying about a selection change in a Result Viewer and notifying about the disposal of a result view.

Event Handler Implementation
Event Handler Implementation

Step 6: Update your control on selection change

Whenever the selection changes your event handler can forward the current context to your control.

Update Controls on Selection Changed
Update Controls on Selection Changed


Visual Studio provides more and more extension points that allow you to add your own tabs to the Result Viewer. Dynatrace leverages this new interface in addition to the interfaces that were support with older versions of Visual Studio, e.g.: LoadTest-Plugin, WebTest-Plugin and WebTestRequest-Plugin.

If you’re interested in running similar load tests, especially involving Visual Studio 2010, you’ll probably be interested in a White Paper I collaborated on about Transforming the Load Test Process.
Also, seeing as Visual Studio 2010 is built on the .NET Platform you might also be interested in my latest White Papers about Continuous Application Performance for Enterprise .NET Systems.

Andreas Grabner has 20+ years of experience as a software developer, tester and architect and is an advocate for high-performing cloud scale applications. He is a regular contributor to the DevOps community, a frequent speaker at technology conferences and regularly publishes articles on You can follow him on Twitter: @grabnerandi