public class DataProviderWithParameter {
@Test (dataProvider = "dp")
public void testMethod(int age, String name) {
System.err.println("(" + name + "," + age + ")");
}
@DataProvider (name = "dp")
public Object[][] getData(ITestContext ctx) {
String name = ctx.getCurrentXmlTest().getLocalParameters().get("name");
return new Object[][] {{1, name}, {2, name}};
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Class1Suite" parallel="false" verbose="2">
<test name="Class1Test">
<parameter name="name" value="TestNG"/>
<classes>
<class name="organized.chaos.forums.DataProviderWithParameter"/>
</classes>
</test> <!-- Class1Test -->
</suite> <!-- Class1Suite -->
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
If not, it could be a nice improvement.