Reputation: 204
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...
Upvotes: 0
Views: 3380
Reputation: 1088
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.
Upvotes: 1