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:
Error calling Initialization method for test class CodedUITests.UsabilityCodedUITools: System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component. Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.IRPFPlayback.SetSkipStepEventName(String skipStepEventName) Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.InitPlayback() Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize() W, 12876, 135, 2013/01/14, 14:51:24.272, 79392686980330, QTAgent32.exe, Playback - [WARNING] Internal warning: Playback engine is already initialized and SkipStepThreadEvent has been created. Cannot change the name of event after its is created.
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.
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 🙂
Join the discussion