Alexander Vanwynsberghe

"There is nothing impossible to him who will try"

Coded UI problem: QTAgent32 Playback Warning

Last week, I ran into a Coded UI issue at a customer. The problem occurred when I tried to execute my Coded UI tests on a remote test-agent machine (using the 2010 version) The execution of the test was just fine, the (WinForms) application started and waited for initialization (because the application takes quite some time to start). But just on the moment when the first Coded UI test wants to start, the application closed. Quite strange..

The exception I got in the test run result was the following:

I had no I idea what the problem was, but after some Bing’ing, I found that it was related to the QTAgent Process not being killed successfully after a test run.

Solution:

Unfortunately, the remedy for this error message Error calling Initialization method for test class xxx: System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component. calls for killing the QTagent Process.

The issue from my side was about the application that has been killed while my tests were running. I didn’t foresee a catch for that, resulting in a QTAgent Process that was not quite behaving like it should have.

To avoid situations like this, you can make use of the ‘Playback.PlaybackError‘ event. This event is raised when an exception occurs during playback.

Just a quick share :-)

Creating a web performance test using Fiddler

As you all know (or should know), Fiddler is a really powerful web debugging proxy which logs all HTTP(S) traffic between your computer and the internet. Fiddler allows you to inspect traffic, set breakpoints, and “fiddle” with incoming or outgoing data.

Now one cool thing I didn’t know before is that you can export fiddler events to a Visual Studio Web Test. This is really easy, but I’ll show you how:

1. Download Fiddler2, install and run the application

2.Capture some traffic, for example open your web application, and perform some actions, in my example, I opened the nuget.org website.

3. Next step is to select the session steps that you want (or do not select any) and click ‘File – Export Sessions – All Sessions/Selected Sessions

3. In this new dialog, you select ‘Visual Studio Web Test

4. When you click next, you can choose where you want to save the web test file.

5. All you have to do know is either include the web test file in a test project from Visual Studio, or you can open it directly with Visual Studio. You’re now able to click ‘Run’ in the test window, and it should start the web test.

That’s it.. really easy!

Cloning Microsoft Test Manager 11 Test Suites

tcm_img

With the next version of Microsoft Test Manager, MTM11, there is a possibility to clone test suites across plans. This is something which can be very helpful if you’re working on multiple releases. This way, you can clone an existing Test Suite from a previous release, and just change the necessary things related to the new release. When you clone a test suite, the new suite will contain the copies of all test cases in the source suite. However it will not retain all historical data like the previous test runs, the related bugs, old results. It provides a clean starting point.

Getting started

This feature is available through the command line utility tcm.exe. You can start this utility using the ‘Developer Command Prompt‘ from Visual Studio 11 (beta). Start->All Programs->Microsoft Visual Studio 11->Visual Studio Tools. Enter ‘tcm‘ to see the list of available commands:

We will continue with the ‘tcm suites’ command. This command will provide us all operations related to Test Suites, like listing and cloning. The first thing you can do is get a list of all available Test Suites using the ‘tcm suites /list’ command. This will give you a list of Suites with an ID and a Name. This ID is useful to know when you want to clone from one Suite to another Suite. For each command you want to execute, you have to provide the URL of your Team Project Collection and the Team Project Name you want to work with. In my case (using the great HOL VM from Brian Keller), the command is:

tcm suites /list /collection:http://vsalm:8080/tfs/DefaultCollection /teamproject:FabrikamFiber

In this example above, I have “TestPlan1” containing the ‘A Demo Suite‘ test suite. What I want to do is clone this test suite into “TestPlan2“. So I want Id 3 to be cloned in Id 2. To do this, just use this command:

tcm suites /clone /suiteid:3 /destinationsuiteid:2 /collection:http://vsalm:8080/tfs/DefaultCollection /teamproject:FabrikamFiber

When this command is executed, the clone operation is ongoing. This command returns an operation Id back. This Id is an identifier of the actual clone process. In some cases, a test plan/test suite can contain a large number of test cases, resulting in an operation which can take a serious amount of time. In my case, it’s only a small one. What you can do to follow the process of the clone operation is executing the following command:

tcm suites /clone /status:2 /collection:http://vsalm:8080/tfs/DefaultCollection /teamproject:FabrikamFiber

As you can see, the operation ‘2‘ has succeeded. You also have some information about the clone operation like the number of test cases cloned and the cloned shared steps.

Each clone operation is stored in the TFS_DefaultCollection (or TFS_YourTPC) database. You can get an overview using table ‘tbl_CloneOperation’ where you have the same information as in the screenshot above.

This is a nice (hidden) feature in the new improved version of Microsoft Test Manager 11. I hope they will include this command in the interface so you don’t have to use the commandline version of the tool. Thanks for reading!