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
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 benefitial 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.
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.
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.
Step 6: Update your control on selection change
Whenever the selection changes your event handler can forward the current context to your control.
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.