From my point of view here are some general guidelines to improve end-to-end execution speed for GUI automation.

1- Build a solid Object Repository by using unique attributes/properties to define test objects.

2-Devide test script into small test functions that are simple (Do not re-implement complex business).

3- Define correct points where to add Sync functions (moving to new page, waiting to object appear/disappear , waiting for property change,…..etc).

4- Use Dynamic waiting not implicit, for the correct behavior / property of a test object.

5- Modify the Driver Time out (Selenium) to be 1 : 5 seconds no more, because each time we use FindElement() Function the Driver will wait this time until object loaded in DOM or throw exception.

– Design your Test Script by a way to get benefit of tool speed and also Synchronized with Application performance.

Example of Selenium/C# Dynamic wait for object to be loaded in DOM and displayed on GUI.

Calling for bellow Function:

Public IwebElement TestObject;
TestObject.Exists(5); // where 5 is time out by seconds.

public static bool Exists(this IWebElement element,int timeOut)
        //GlobalVars.Test.Browser is IwebDriver Object
         bool isExist = false;

        // check that element is not null;
        if (element == null)
            return false;

        // check the element existance.

            GlobalVars.Test.Browser.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(0);
            WebDriverWait wait = new WebDriverWait(GlobalVars.Test.Browser, TimeSpan.FromSeconds((double)timeOut));
            isExist = wait.Until<bool>((d) => { try { return element.Displayed; } catch (Exception ex) { return false; } });

            return isExist;
        catch (Exception ex)
            return false;
            GlobalVars.Test.Browser.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(GlobalVars.Test.BrowserTimeOut);


Source link


Please enter your comment!
Please enter your name here