locked
How do I make CodedUI wait for application to fully load? RRS feed

  • Question

  • I have an application that starts, then a splash screen shows with a progress of loading, and then the main application window appears. I want the CUI to wait until the main window appears before continue on with the test.

    Brandon
    Wednesday, March 10, 2010 9:54 PM

Answers

  • Hi

    If somehow the thread can pump messges then you shouldnt hit hang issue. If that is not achievable then you need to put a sleep in your codeduitest (for considerable amount of time which you think the splash screen will take to go away).

     

    Thanks

    Siddhartha

    Tuesday, March 23, 2010 4:00 AM
    Moderator

All replies

  • You can put a conditional wait  using UITestControl.WaitForControlExist()   for any control or main window which will appear on your application once it is fully loaded.

    Thursday, March 11, 2010 5:03 AM
  • Thursday, March 11, 2010 9:18 AM
  • I've tried using WaitForControlExist() but can't seem to get it to work. I have this test method:
            [TestMethod]
            public void SwitcherProDTTestMethod()
            {
                // Start SwitcherPro
                this.UIMap.StartSwitcherProDT();
    
                this.UIMap.UISwitcherProDesktopTPWindow.WaitForControlExist();
    
                <snip>
           }

    The application is started using:
               
            public void StartSwitcherProDT()
            {
                ApplicationUnderTest switcherProDTApplication = ApplicationUnderTest.Launch(this.StartSwitcherProDTParams.ExePath, this.StartSwitcherProDTParams.AlternateExePath, "/appstartversion 3.0.5.20687");
            }

    Here's the generated window definition:
        [GeneratedCode("Coded UITest Builder", "10.0.30128.1")]
        public class UISwitcherProDesktopTPWindow : WinWindow
        {
    
            public UISwitcherProDesktopTPWindow()
            {
                #region Search Criteria
                this.SearchProperties[WinWindow.PropertyNames.Name] = "SwitcherPro Desktop - TPS40007 4V to 2V @ 5A - 2403";
                this.SearchProperties.Add(new PropertyExpression(WinWindow.PropertyNames.ClassName, "WindowsForms10.Window", PropertyExpressionOperator.Contains));
                this.WindowTitles.Add("SwitcherPro Desktop - TPS40007 4V to 2V @ 5A - 2403");
                #endregion
            }
        }

    The application starts, splash screen comes and goes and the main window comes up. After the window comes up, the test just sits at this line:

    this.UIMap.UISwitcherProDesktopTPWindow.WaitForControlExist();
    
    And never gets past. Its like it can't find the window.

    Brandon
    Thursday, March 11, 2010 7:58 PM
  • Also, from what I understand, the search property is searching for a winforms application with the window name/title "SwitcherPro Desktop - TPS40007 4V to 2V @ 5A - 2403". This was the name of the window when I ran the application during the recording, but the window name can change. It'll always have "SwitcherPro Desktop", but sometimes it'll start with the name of a design appended to it like above.

    How do I change it to search properly?

    Brandon
    Thursday, March 11, 2010 10:03 PM
  • You can the search properties of the control from anywhere unless you have access to the control object.
    Here is your can you can edit the search properties inside your test method also.

     

     

    public void SwitcherProDTTestMethod()

    {

     

     

    // Start SwitcherPro

     

     

    this.UIMap.StartSwitcherProDT();

     

     

    this.UIMap.UISwitcherProDesktopTPWindow.SearchProperties.Add(WinWindow.PropertyNames.Name,"SwitcherPro Desktop", PropertyExpressionOperator.Contains);

     

     

    this.UIMap.UISwitcherProDesktopTPWindow.WaitForControlExist();

     

    }

    Friday, March 12, 2010 4:28 AM
  • That's not working either.

    So, I started over and found what might be a bigger issue here. I went to make just a recording of starting the application. This time I found an odd behavior.

    - I hit RECORD.
    - I start the application.
    - Splash screen shows up. Top right corner of splash screen, there's a "Currently Recording".
    - Main window comes up. Top right corner of main window, there's a "Currently Recording".

    At this point, the application is in a constant busy state (hour glass). I also notice that the splash screen is still up, just behind the main window. Normally, it goes away just before the main window appears, but it seems the recorder is keeping it up. I moved the main window and on the splash screen is the "Currently Recording". Why is it still "recording" this window?

    Because of this I can't pause or generate code. If I try either of these a progress of "Please wait" comes up and stalls at about 20%. I have to kill the application to get control back and then the recorder completes the action.

    So I can't get beyond starting the application.
    Friday, March 12, 2010 4:18 PM
  • Well, I'm still having no luck getting this to work. I'm still not able to get the test to "see" the window. Very frustrating.
    Tuesday, March 16, 2010 6:24 PM
  • This doesn't make sense to me so perhaps someone can shed some light on this.

    I'm trying to understand what the test is doing, so I change the code to this:

    this.UIMap.StartSwitcherPro();
    
    //this.UIMap.UISwitcherProDesktopWindow.WaitForControlExist();
    
    while (!this.UIMap.UISwitcherProDesktopWindow.Exists)
    {
        System.Threading.Thread.Sleep(1000); <breakpoint>
    }
    
    this.UIMap.CloseSwitcherPro(); <breakpoint>

    As you can see, I added a breakpoint in two places. I debug the test and my application starts but then the test stalls. It never reaches either breakpoint. I break into the running test and it indicates it is on the "while" line. It can't get past this for some reason. Why not? This isn't a "WaitFor", its just a bool property.

    So, I stop the test leaving the application still open. I comment out the "StartSwitcherPro()" line and re-run the test. This time, it runs thru to the second breakpoint at CloseSwitcherPro(). So now it can see that the window exists but before it couldn't?

    What is going on here? So far in order to get this to work, I have to start the application manually before running the test so that the test can see that the window exists. Kinda defeats the point of automation.

    Brandon

    Tuesday, March 16, 2010 7:59 PM
  • Hi,

    For the Recording getting hanged issue can you try adding this in the Codeduitestbuilder.exe.config file to see if it fixes the problem (recording hang problem)?

        <!-- Show "Currently Recording" caption on windows under recording. -->
        <add key="ShowCurrentlyRecording" value="false"/>

    Note:- This is just for debugging purpose and not not an officially supported configuration.

    Thanks
    Siddhartha.
    Wednesday, March 17, 2010 4:28 AM
    Moderator
  • Hi,

    I suspect there is a deadlock some where between the Codeduitest and the Application. Questions

    1) Does the splash screen part of the exe you have for the application or splash screen is a different exe which eventually launches the main Application
    2) Can you check the exe name given as part of the Launch is fine and that it is path to the applcation you are trying to launch.

    Also to debug the hang issue can you do the following steps and share the stack traces

    1) Debug the test and let it hang
    2) Now break the debugging and see goto the thread which is running the test (the thread name will contain the test name).
    3) Goto Tools Menu->Option in that goto the Debugging TreeItem and uncheck the Enable just my code.
    4) Open the Call Stack window from (DEbug menu item -> Windows- >Callstack)
    5) Copy the stack trace and share here.

    Also it might be intersting to see the stack trace of the Application and see where it is hanged (just attach the debugger using another VS session and goto the main thread and see where it is hanged).

    Thanks
    Siddhartha
    Wednesday, March 17, 2010 4:35 AM
    Moderator
  • Hi,

    For the Recording getting hanged issue can you try adding this in the Codeduitestbuilder.exe.config file to see if it fixes the problem (recording hang problem)?

        <!-- Show "Currently Recording" caption on windows under recording. -->
        <add key="ShowCurrentlyRecording" value="false"/>

    Note:- This is just for debugging purpose and not not an officially supported configuration.

    Thanks
    Siddhartha.
    Siddhartha,

    This does correct the recording from hanging.

    Brandon
    Wednesday, March 17, 2010 6:00 PM
  • Hi,

    I suspect there is a deadlock some where between the Codeduitest and the Application. Questions

    1) Does the splash screen part of the exe you have for the application or splash screen is a different exe which eventually launches the main Application
    2) Can you check the exe name given as part of the Launch is fine and that it is path to the applcation you are trying to launch.
    1) The splash screen is part of the exe, but in a different thread.
    2) Verified that the the ExePath in the Launch is correct.
    Also to debug the hang issue can you do the following steps and share the stack traces

    1) Debug the test and let it hang
    2) Now break the debugging and see goto the thread which is running the test (the thread name will contain the test name).
    3) Goto Tools Menu->Option in that goto the Debugging TreeItem and uncheck the Enable just my code.
    4) Open the Call Stack window from (DEbug menu item -> Windows- >Callstack)
    5) Copy the stack trace and share here.

    Also it might be intersting to see the stack trace of the Application and see where it is hanged (just attach the debugger using another VS session and goto the main thread and see where it is hanged).

    Thanks
    Siddhartha

    I found two threads with the name, so I'll share both stacks here if it helps:


    Here's the call stack for "Agent: adapter run thread for test 'CodedUITestMethod1'"
     	[Managed to Native Transition]	
    >	Microsoft.VisualStudio.TestTools.UITest.Playback.dll!Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindTopLevelWindowHelper(string queryId = ";[VisibleOnly]ControlType='Window' && Name='SwitcherPro Desktop' && ClassName=>'WindowsForms10.Window'") + 0x5ca bytes	
     	Microsoft.VisualStudio.TestTools.UITest.Playback.dll!Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindFromPartialQueryId(string queryId = ";[VisibleOnly]ControlType='Window' && Name='SwitcherPro Desktop' && ClassName=>'WindowsForms10.Window'") + 0x313 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.UITestControl(string queryId = ";[VisibleOnly]ControlType='Window' && Name='SwitcherPro Desktop' && ClassName=>'WindowsForms10.Window'") + 0x98 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FromQueryId(string queryId = ";[VisibleOnly]ControlType='Window' && Name='SwitcherPro Desktop' && ClassName=>'WindowsForms10.Window'") + 0x35 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.SearchTopLevelWindow(Microsoft.VisualStudio.TestTools.UITesting.ISearchArgument topLevelSearchArg = {Microsoft.VisualStudio.TestTools.UITesting.UITestControlSearchArgument}, string topLevelElementQueryId = ";[VisibleOnly]ControlType='Window' && Name='SwitcherPro Desktop' && ClassName=>'WindowsForms10.Window'") + 0x175 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetTitleUpdatedTopLevelWindow(Microsoft.VisualStudio.TestTools.UITesting.ISearchArgument topLevelSearchArg = {Microsoft.VisualStudio.TestTools.UITesting.UITestControlSearchArgument}, string queryId = ";[VisibleOnly]ControlType='Window' && Name='SwitcherPro Desktop' && ClassName=>'WindowsForms10.Window'", System.Collections.Generic.IList<string> windowTitles = Count = Cannot evaluate expression because a native frame is on top of the call stack.) + 0x29f bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetTopLevelElement(bool useCache = true, bool useCacheOnly = false, Microsoft.VisualStudio.TestTools.UITesting.ISearchArgument searchArg = {Microsoft.VisualStudio.TestTools.UITesting.UITestControlSearchArgument}, System.Collections.Generic.IList<string> windowTitles = Count = Cannot evaluate expression because a native frame is on top of the call stack., ref int timeLeft = 120000) + 0x39f bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetElement(bool useCache = true, Microsoft.VisualStudio.TestTools.UITesting.ISearchArgument searchArg = {Microsoft.VisualStudio.TestTools.UITesting.UITestControlSearchArgument}) + 0x2af bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.Search(Microsoft.VisualStudio.TestTools.UITesting.ISearchArgument searchArg = {Microsoft.VisualStudio.TestTools.UITesting.UITestControlSearchArgument}) + 0xe4 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindInternal() + 0x74 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Find() + 0x26 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetProperty(string propertyName = "Exists") + 0x89 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetPropertyInternal<bool>(string propertyName = "Exists") + 0x30 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Exists.get() + 0x26 bytes	
     	DesktopTest2.dll!DesktopTest2.CodedUITest1.CodedUITestMethod1() Line 31 + 0x22 bytes	C#
     	[Native to Managed Transition]	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.DefaultTestMethodInvoke(object[] args = {object[0]}) + 0x7c bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.DefaultTestMethodDecorator.Invoke(object[] args = {object[0]}) + 0x2b bytes	
     	Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll!Microsoft.VisualStudio.TestTools.UITesting.CodedUITestInvoker.Invoke(object[] parameters = {object[0]}) + 0xc9 bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunTestMethod() + 0x2dd bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.ExecuteTest() + 0x12a bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.Execute(Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestResult result = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestResult}) + 0xd2 bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.ExecuteSingleTest(Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter executer = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter}, Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestResult result = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestResult}, Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement test = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement}, Microsoft.VisualStudio.TestTools.Execution.ITestContext testContext = {System.Runtime.Remoting.Proxies.__TransparentProxy}, Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext userContext = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext}, bool isLoadTest = false) + 0x28 bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.ExecuteSingleTest(Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter executer = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter}, Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement test = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement}, Microsoft.VisualStudio.TestTools.Execution.ITestContext testContext = {System.Runtime.Remoting.Proxies.__TransparentProxy}, Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext userContext = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext}, bool isLoadTest = false) + 0x93 bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.Run(Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement test = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement}, Microsoft.VisualStudio.TestTools.Execution.ITestContext testContext = {System.Runtime.Remoting.Proxies.__TransparentProxy}, bool isLoadTest = false, bool useMultipleCpus = false) + 0x475 bytes	
     	[Appdomain Transition]	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter.Run(Microsoft.VisualStudio.TestTools.Common.ITestElement testElement, Microsoft.VisualStudio.TestTools.Execution.ITestContext testContext = {Microsoft.VisualStudio.TestTools.Agent.TestContext}, bool isLoadTest = false) + 0x396 bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter.Run(Microsoft.VisualStudio.TestTools.Common.ITestElement testElement, Microsoft.VisualStudio.TestTools.Execution.ITestContext testContext) + 0x2a bytes	
     	Microsoft.VisualStudio.QualityTools.AgentObject.dll!Microsoft.VisualStudio.TestTools.Agent.AgentExecution.CallAdapterRunMethod(object obj) + 0x140 bytes	
     	mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x93 bytes	
     	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool ignoreSyncCtx) + 0xb0 bytes	
     	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x2c bytes	
     	mscorlib.dll!System.Threading.ThreadHelper.ThreadStart(object obj) + 0x4e bytes	
     	[Native to Managed Transition]	
    


    Here's the call stack for "Agent: state execution thread for test 'CodedUITestMethod1'"
     	[In a sleep, wait, or join]	
    >	mscorlib.dll!System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle waitableSafeHandle, long millisecondsTimeout, bool hasThreadAffinity, bool exitContext) + 0x2b bytes	
     	mscorlib.dll!System.Threading.WaitHandle.WaitOne(int millisecondsTimeout, bool exitContext) + 0x2d bytes	
     	mscorlib.dll!System.Threading.WaitHandle.WaitOne() + 0x10 bytes	
     	Microsoft.VisualStudio.QualityTools.Common.dll!Microsoft.VisualStudio.TestTools.Common.StateMachine<Microsoft.VisualStudio.TestTools.Common.TestState>.Execute() + 0x45 bytes	
     	Microsoft.VisualStudio.QualityTools.AgentObject.dll!Microsoft.VisualStudio.TestTools.Agent.AgentExecution.ExecuteTest(bool forceSynchronousExecution = false) + 0x45 bytes	
     	Microsoft.VisualStudio.QualityTools.AgentObject.dll!Microsoft.VisualStudio.TestTools.Agent.AgentExecution.ExecuteTest(object obj) + 0x8d bytes	
     	mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x93 bytes	
     	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool ignoreSyncCtx) + 0xb0 bytes	
     	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x2c bytes	
     	mscorlib.dll!System.Threading.ThreadHelper.ThreadStart(object obj) + 0x4e bytes	
     	[Native to Managed Transition]	
    


    Wednesday, March 17, 2010 6:14 PM
  • Hi

    The first stack trace is the one I am looking for. Can you do one more thing and then share the stack again. Goto project properties and in debug tab Check "Enable Unmanaged Debugging" checkbox and again break when the test is hanged?

    This will help us understand what exact call is hanged. Also see if you can figure out where actually the Application is hanged during this time (again you can do this using debugger).


    Also can you try one more thing as suggested below. I have added a Sleep of 10 sec. See if this works out fine.

    this.UIMap.StartSwitcherPro();
    
    Thread.Sleep(10000);
    while (!this.UIMap.UISwitcherProDesktopWindow.Exists)
    {
        System.Threading.Thread.Sleep(1000); <breakpoint>
    }
    
    this.UIMap.CloseSwitcherPro(); <breakpoint>
    
    PS: I am just trying to debug what can be the issue here

    Thanks for your patience
    Siddhartha


    Thanks
    Siddhartha
    Wednesday, March 17, 2010 7:33 PM
    Moderator
  • Hi

    One more question is that different thread (which shows splash screen) pumping messages?

    Thanks
    Siddhartha
    Wednesday, March 17, 2010 7:38 PM
    Moderator
  • Hi

    The first stack trace is the one I am looking for. Can you do one more thing and then share the stack again. Goto project properties and in debug tab Check "Enable Unmanaged Debugging" checkbox and again break when the test is hanged?

    This will help us understand what exact call is hanged. Also see if you can figure out where actually the Application is hanged during this time (again you can do this using debugger).
    Here's the stack trace:

     	ntdll.dll!7c90e4f4() 	
     	[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]	
     	ntdll.dll!7c90df3c() 	
     	kernel32.dll!7c8025db() 	
     	kernel32.dll!7c802542() 	
     	Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.dll!0f94032b() 	
     	Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.dll!0f9401a5() 	
     	Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.dll!0f93e525() 	
     	Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.dll!0f9565b4() 	
     	Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.dll!0f955b67() 	
     	ole32.dll!774fd430() 	
     	oleaut32.dll!77124a44() 	
     	oleaut32.dll!771248b5() 	
     	Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.dll!0f92ef38() 	
     	oleaut32.dll!77124a44() 	
     	Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.dll!0f946ddb() 	
     	Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.dll!0f931105() 	
     	[Managed to Native Transition]	
     	Microsoft.VisualStudio.TestTools.UITest.Playback.dll!Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindTopLevelWindowHelper(string queryId = ";[VisibleOnly]ControlType='Window' && Name='SwitcherPro Desktop' && ClassName=>'WindowsForms10.Window'") + 0x5ca bytes	
     	Microsoft.VisualStudio.TestTools.UITest.Playback.dll!Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindFromPartialQueryId(string queryId = ";[VisibleOnly]ControlType='Window' && Name='SwitcherPro Desktop' && ClassName=>'WindowsForms10.Window'") + 0x313 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.UITestControl(string queryId = ";[VisibleOnly]ControlType='Window' && Name='SwitcherPro Desktop' && ClassName=>'WindowsForms10.Window'") + 0x98 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FromQueryId(string queryId = ";[VisibleOnly]ControlType='Window' && Name='SwitcherPro Desktop' && ClassName=>'WindowsForms10.Window'") + 0x35 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.SearchTopLevelWindow(Microsoft.VisualStudio.TestTools.UITesting.ISearchArgument topLevelSearchArg = {Microsoft.VisualStudio.TestTools.UITesting.UITestControlSearchArgument}, string topLevelElementQueryId = ";[VisibleOnly]ControlType='Window' && Name='SwitcherPro Desktop' && ClassName=>'WindowsForms10.Window'") + 0x175 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetTitleUpdatedTopLevelWindow(Microsoft.VisualStudio.TestTools.UITesting.ISearchArgument topLevelSearchArg = {Microsoft.VisualStudio.TestTools.UITesting.UITestControlSearchArgument}, string queryId = ";[VisibleOnly]ControlType='Window' && Name='SwitcherPro Desktop' && ClassName=>'WindowsForms10.Window'", System.Collections.Generic.IList<string> windowTitles = Count = Cannot evaluate expression because a native frame is on top of the call stack.) + 0x29f bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetTopLevelElement(bool useCache = true, bool useCacheOnly = false, Microsoft.VisualStudio.TestTools.UITesting.ISearchArgument searchArg = {Microsoft.VisualStudio.TestTools.UITesting.UITestControlSearchArgument}, System.Collections.Generic.IList<string> windowTitles = Count = Cannot evaluate expression because a native frame is on top of the call stack., ref int timeLeft = 120000) + 0x39f bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetElement(bool useCache = true, Microsoft.VisualStudio.TestTools.UITesting.ISearchArgument searchArg = {Microsoft.VisualStudio.TestTools.UITesting.UITestControlSearchArgument}) + 0x2af bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.Search(Microsoft.VisualStudio.TestTools.UITesting.ISearchArgument searchArg = {Microsoft.VisualStudio.TestTools.UITesting.UITestControlSearchArgument}) + 0xe4 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindInternal() + 0x74 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Find() + 0x26 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetProperty(string propertyName = "Exists") + 0x89 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetPropertyInternal<bool>(string propertyName = "Exists") + 0x30 bytes	
     	Microsoft.VisualStudio.TestTools.UITesting.dll!Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Exists.get() + 0x26 bytes	
    >	DesktopTest2.dll!DesktopTest2.CodedUITest1.CodedUITestMethod1() Line 31 + 0x22 bytes	C#
     	[Native to Managed Transition]	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.DefaultTestMethodInvoke(object[] args = {object[0]}) + 0x7c bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.DefaultTestMethodDecorator.Invoke(object[] args = {object[0]}) + 0x2b bytes	
     	Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll!Microsoft.VisualStudio.TestTools.UITesting.CodedUITestInvoker.Invoke(object[] parameters = {object[0]}) + 0xc9 bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunTestMethod() + 0x2dd bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.ExecuteTest() + 0x12a bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.Execute(Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestResult result = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestResult}) + 0xd2 bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.ExecuteSingleTest(Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter executer = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter}, Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestResult result = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestResult}, Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement test = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement}, Microsoft.VisualStudio.TestTools.Execution.ITestContext testContext = {System.Runtime.Remoting.Proxies.__TransparentProxy}, Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext userContext = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext}, bool isLoadTest = false) + 0x28 bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.ExecuteSingleTest(Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter executer = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter}, Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement test = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement}, Microsoft.VisualStudio.TestTools.Execution.ITestContext testContext = {System.Runtime.Remoting.Proxies.__TransparentProxy}, Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext userContext = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext}, bool isLoadTest = false) + 0x93 bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.Run(Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement test = {Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement}, Microsoft.VisualStudio.TestTools.Execution.ITestContext testContext = {System.Runtime.Remoting.Proxies.__TransparentProxy}, bool isLoadTest = false, bool useMultipleCpus = false) + 0x475 bytes	
     	[Appdomain Transition]	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter.Run(Microsoft.VisualStudio.TestTools.Common.ITestElement testElement, Microsoft.VisualStudio.TestTools.Execution.ITestContext testContext = {Microsoft.VisualStudio.TestTools.Agent.TestContext}, bool isLoadTest = false) + 0x396 bytes	
     	Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter.dll!Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter.Run(Microsoft.VisualStudio.TestTools.Common.ITestElement testElement, Microsoft.VisualStudio.TestTools.Execution.ITestContext testContext) + 0x2a bytes	
     	Microsoft.VisualStudio.QualityTools.AgentObject.dll!Microsoft.VisualStudio.TestTools.Agent.AgentExecution.CallAdapterRunMethod(object obj) + 0x140 bytes	
     	mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x93 bytes	
     	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool ignoreSyncCtx) + 0xb0 bytes	
     	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x2c bytes	
     	mscorlib.dll!System.Threading.ThreadHelper.ThreadStart(object obj) + 0x4e bytes	
     	[Native to Managed Transition]	
     	kernel32.dll!7c80b713() 	
    



    Also can you try one more thing as suggested below. I have added a Sleep of 10 sec. See if this works out fine.

    this
    
    
    .UIMap.StartSwitcherPro();

    Thread.Sleep(10000);
    while (!this .UIMap.UISwitcherProDesktopWindow.Exists)
    {
    System.Threading.Thread.Sleep(1000); <breakpoint>
    }

    this .UIMap.CloseSwitcherPro(); <breakpoint>
    PS: I am just trying to debug what can be the issue here

    Thanks for your patience
    Siddhartha


    Thanks
    Siddhartha

    Adding the sleep, the check for Exists now works and the test goes on, but of course this isn't a solution since we don't know how long we need to wait each time and thus the point of the WaitForConditionExists() functions.

    Brandon

    Thursday, March 18, 2010 4:13 PM
  • Hi

    I think I know the issue. This means that the Splash screen is not pumping message. During playback we try to search for TopLevel window. When the splash screen is opened then any win32 call on the Splash screen hangs and even the splash should hang.

    This means that the splash screen is not pumping messages and hence causes the hang. Adding Sleep makes it work because till then the Splash screen goes away and playback doesnt hit the splash screen.

    Can you check with the repective dev to see if the thread on which splash screen is being shown is Pumping messages ?

     

    Thanks

    Siddhartha

    Friday, March 19, 2010 12:01 PM
    Moderator
  • Hi

    I think I know the issue. This means that the Splash screen is not pumping message. During playback we try to search for TopLevel window. When the splash screen is opened then any win32 call on the Splash screen hangs and even the splash should hang.

    This means that the splash screen is not pumping messages and hence causes the hang. Adding Sleep makes it work because till then the Splash screen goes away and playback doesnt hit the splash screen.

    Can you check with the repective dev to see if the thread on which splash screen is being shown is Pumping messages ?

     

    Thanks

    Siddhartha

     

    The splash is in its own thread

    It does not pump any messages.

     

    The application keeps a handle to that thread and once the main window is shown (its an event in the mainWindow) the splash is closed.

     

    Brandon

     

    Monday, March 22, 2010 8:43 PM
  • Hi

    If somehow the thread can pump messges then you shouldnt hit hang issue. If that is not achievable then you need to put a sleep in your codeduitest (for considerable amount of time which you think the splash screen will take to go away).

     

    Thanks

    Siddhartha

    Tuesday, March 23, 2010 4:00 AM
    Moderator
  • Ok, I'll see if we can have it pump messages or I'll just grunt and add a wait :)

     

    Thanks for all your help,

    Brandon

    Tuesday, March 23, 2010 3:00 PM