locked
FindMatchingControls method is taking more time. RRS feed

  • Question

  • Hi Everyone,

    While working with InternetExplorer main window I am seeing some performance issue with FindMatchingControls method. 

    I am observing that FindMatchingControls method is taking more time if I increase WaitForReadyTimeout's actual value. Here Taking more time means , time taken to give the collection of similar UITestControls. 

    During this process I opened only InternetExplorer browser and VS 2012 with update 4. No other window is opened.

    Here is my code:

    Playback.PlaybackSettings.WaitForReadyTimeout = 1200000;
                    
                    BrowserWindow IEmainWindowTestControl = new BrowserWindow();
                    IEmainWindowTestControl.SearchProperties.Add(UITestControl.PropertyNames.Name, "Windows Internet Explorer", PropertyExpressionOperator.Contains);
                    IEmainWindowTestControl.SearchProperties.Add(UITestControl.PropertyNames.ClassName, "IEFrame", PropertyExpressionOperator.EqualTo);
                    IEmainWindowTestControl.SearchProperties.Add(UITestControl.PropertyNames.ControlType, "Window", PropertyExpressionOperator.EqualTo);
                  
                    UITestControl test = (UITestControl)IEmainWindowTestControl;
                  // Below method is taking more time depends on Playback.PlaybackSettings.WaitForReadyTimeout value.
                    UITestControlCollection abcdef = test.FindMatchingControls();

    Here is the report of my observation.



    So, I need some more info on this like:

    1. What WaitForReadyTimeout will actually do?
    2. What is the good value of WaitForReadyTimeout  to be used?
    3. Is my given report expected? If yes, How can improve performance while using FindMatchingControl method.
    4. I am not seeing this much drastic change while using the same mechanism for any desktop applications, So is it commandeered to use FindMatchingControls method for browser main window?

    Any help could be highly appreciated.

    Regards,
    Abilash


    Tuesday, October 14, 2014 11:36 AM

Answers

  • Hi,

    Referenced from this blog: Configuring Playback in VSTT 2010

    Wait for Ready Timeout – How long should the engine continue waiting for a control to be ready?  By Default, 60s. WaitForReadyTimeout property specifies the implicit timeout for the wait operation.

    FindMatchingControls Method returns a collection of all UITestControls that match the specified SearchProperties and FilterProperties.

    The Coded UI engine implicitly calls WaitForControlReady for all actions to wait for the control to be ready before doing any operation, until the time-out expires. Before operating FindMatchingControls, the engine waits for a control to be ready. So if the Wait for Ready Timeout increases, then it is feasible that the time taking by FindMatchingControls also increases.

    In my opinion, your given report is expected. As for how to improve performance while using FindMatchingControl, you need set a proper value for WaitForReadyTimeout. For example, if the same count controls are found and returned under different values of WaitForReadyTimeout, you should set the WaitForReadyTimeout to 60000.

    Another way to improve performance is to specific search properties and filter properties to search UITestControl test and then use test.FindMatchingControls() to return a control collection.

    I can’t make sure that such drastic change on FindMatchingControls method is only for browser main window. As far as I know, some controls may be not loaded fine when we open a web page in browser because of some internet issue or something else, maybe controls in the desktop application can be loaded fine, so you don’t see such much drastic change for desktop applications.

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    • Edited by Amanda Zhu Wednesday, October 15, 2014 7:16 AM edit
    • Marked as answer by Amanda Zhu Monday, October 20, 2014 1:35 AM
    Wednesday, October 15, 2014 7:07 AM