1
votes

I have a TestNG XML in the following format:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="1" name="Suite" parallel="tests">
    <test name="Mobile Automation Test 1">
        <classes>
            <class name="com.algoworks.automationmobile.Base.Class1" />
            <class name="com.algoworks.automationmobile.Base.Class2" />
        </classes>
    </test> <!-- Test -->
    <listeners>
        <listener class-name="com.algoworks.automationmobile.Listener.AutomationListener"></listener>
    </listeners>
</suite> <!-- Suite -->

This suite has 2 classes where each class has some @Test methods. Now I want my suite to run like 3 more times in the same order like it ran i.e all class1 methods then class2 methods. How can I achieve this? I am using Selenium WebDriver with Core Java to run my automation suite.

1
The link you posted shows how to run different suites. That is not what I am looking for.Varun Bali

1 Answers

0
votes

Either you can copy Test tags three times in the same suite like below:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="1" name="Suite" parallel="tests">
    <test name="Mobile Automation Test 1">
        <classes>
            <class name="com.algoworks.automationmobile.Base.Class1" />
            <class name="com.algoworks.automationmobile.Base.Class2" />
        </classes>
    </test> <!-- Test -->
    <test name="Mobile Automation Test 2">
        <classes>
            <class name="com.algoworks.automationmobile.Base.Class1" />
            <class name="com.algoworks.automationmobile.Base.Class2" />
        </classes>
    </test> <!-- Test -->
    <test name="Mobile Automation Test 3">
        <classes>
            <class name="com.algoworks.automationmobile.Base.Class1" />
            <class name="com.algoworks.automationmobile.Base.Class2" />
        </classes>
    </test> <!-- Test -->
</suite> <!-- Suite -->

Or

You can run TestNG XML from Command prompt three times via a BAT file.