jeudi 24 mai 2018

TestNG to execute test cases without closing browser

I use TestNG and have several test cases. I defined those in testng.xml.

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="MyTestSuite1" verbose="2" parallel="methods" thread-count="1">
    <listeners>
        <listener class-name="utils.TestNGListener"></listener>
    </listeners>

    <test name="Regression" parallel="false" verbose="2">
        <classes>
            <class name="test.LoginTest" />
            <class name="test.ClearTest" />
            <class name="test.SendMessageTest" />
        </classes>
    </test>
</suite>

Execution starts with the first class, it is successful, but browser is closed and after execution of second class is started instead of execution on same browser window.

main() method:

TestNG testNG = new TestNG();
testNG.setTestSuites(Arrays.asList("testng.xml"));
testNG.setPreserveOrder(true);
testNG.run();

Aucun commentaire:

Enregistrer un commentaire