Search code examples
seleniumtestngmicrosoft-edgetestng-eclipseselenium-edgedriver

testng.xml suite Skip all test classes if it gets fail, it happens only for Microsoft Edge Browser


Executing Multiple classes with testng.xml suite, Where If any single class or test got fail it will skip only that particular test and go ahead for next test suite, for Firefox and Chrome. But, in case of Microsoft edge it can't handle Fail Test suite. And it creates Fail/Skip script for rest all.

Reference of .XMl suite:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite"  parallel="tests" verbose="1">
    <test name="Login-Registration Test" preserve-order="true">
        <classes>
            <class name="myAccount.login" />
            <class name="myAccount.registration" />
        </classes>
    </test> 
    <!-- Test -->
</suite> <!-- Suite -->

Here its example of 2 classes, Where it will execute Login Test suite and after that Registration as suite. But, if Login gets fail it will not execute Registration Suite for Edge. Which is working for Firefox and Chrome.

I am invoking browsers with WebDriver:

        // driver = new ChromeDriver();
        // driver = new FirefoxDriver();
        driver = new EdgeDriver();

Calling @AfterMethod annotation after each @Test, with ITestResult

 @AfterMethod
    public void calltestStatus(ITestResult result) throws IOException
    {
        testStatus(result);
        count++;
        driver.manage().deleteAllCookies();
    }

And here is ITestResult definition,

public void testStatus(ITestResult result) throws IOException
    {
        if (result.getStatus() == ITestResult.FAILURE) {

            testResult = "Test Fail :" + result.getName();

            testResult = "Details of Fail Testcase:" + result.getThrowable();
            extentReport.flush();

        } else if (result.getStatus() == ITestResult.SUCCESS) {

            testResult = "Test Pass :" + result.getName();

        } else if (result.getStatus() == ITestResult.SKIP) {

            testResult = "Test Skip :" + result.getName();

        } else {

            testResult = "Test Undefined :" + result.getName() + "<br>Status : " + result.getStatus();

            testResult = "Details of undefined Testcase:" + result.getThrowable();
        }
    }

TestNG or Selenium is working differently for Edge ?


Solution

  • This is the limitation of Edge Browser, Where it can invoke only single instance for Web Driver Testing.

    Its relevant to my case, When it got fail and invoke for another instance to open Edge Browser of another Suite, But Edge driver is not supported so far. So it got Skip and fail for rest all.

    https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13618786/ Click to See