0

I've 3 @Test methods say, methodA, methodB and methodC. All the 3 methods are used to fill a Form one by one that takes input from CSV file. My XML file looks like below...

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Fill Forms">
    <test name="Fill multiple times">
        <classes>
            <class name="com.class"/>
                <methods>
                    <include name='methodA'/>
                    <include name='methodB'/>
                    <include name='methodC'/>
                </methods>
            </class>
        </classes>
    </test>
</suite>

I want to run the Test 'Fill Multiple Times' multiple times.

Kindly suggest me an idea...

Bala
  • 184
  • 3
  • 19

1 Answers1

1

If each method is interacting with the same elements and just passing different inputs, try parameterizing your tests with one of the approaches available in TestNG.

http://testng.org/doc/documentation-main.html#parameters

XML Parameters will work well, but this will result in a more verbose Suite XML file.

My recommendation, assuming the above condition is true, would be to use a DataProvider with your test. This way, you only need to write the test method once and the DataProvider will iterate over the test for each data set you define.

EDIT: Since your test isn't able to be parameterized... If you're simply looking to repeat the test methods a number of times, you could either repeat the <test> node on the XML as many times as you wish to repeat the execution. If you wish to keep your XML from getting too verbose, you could look into creating a test case factory.

tim-slifer
  • 1,068
  • 1
  • 9
  • 17
  • Hii... Thanks for your comments. All the forms contains different elements and different input sets. Data provider iterates only the particular method multiple Times.I want to iterate the whole Test multiple times. Thanks again. – Bala Sep 23 '16 at 04:42
  • Understood. I updated my response above with some new information... hope it helps. – tim-slifer Sep 23 '16 at 05:30