Hi Krishnan,
well, let me try to reformulate.
Parameter values may come from @Parameters annotation or from @DataProvider. Those will provide values for the parameters .
I would like to know the names of the parameters.
So let me try to showcase that with an example; let's consider 2 tests as follows.. in my perspective, the names for the parameters would be "v1" and "v2" for the test "parameterAnnotatedTest()" and "n1" and "n2" for the dataProviderTest(). For the parameterAnnotatedTest() I think we could also consider the names coming from the @Parameters... it's discussable but I think an approach where the names of parameters are always derived from the name of the arguments of the test method makes probably more sense.
@Test
@Parameters ({"val1", "val2"})
public void parameterAnnotatedTest(int v1, int v2) {
int finalsum = v1 + v2;
System.out.println("The final sum of the given values is " + finalsum);
}
@DataProvider(name = "test1")
public Object[][] createData1() {
return new Object[][] {
{ "Cedric", new Integer(36) },
{ "Anne", new Integer(37)},
};
}
//This test method declares that its data should be supplied by the Data Provider
//named "test1"
@Test(dataProvider = "test1")
public void dataProviderTest(String n1, Integer n2) {
System.out.println(n1 + " " + n2);
}