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!