lundi 23 janvier 2017

How can we pass Parameter and Data Provider to same Method in Testng

Hi I am trying data driven in Java. I read excel and passed value to variable "test2" and "test 3" to my test. Also, I need one more parameter "test1" which I am sending from testing.xml. Now on executing below test throws me an error

org.testng.TestNGException: The data provider is trying to pass 2 parameters but the method com.xxxxx.xxx takes 3 and TestNG is unable in inject a suitable object

So how to pass parameter and data provider to same method. Thanks

/* testdataprovider will return the test2 and test3 parameter value */
@Parameters("test1")
@Test(dataProvider = "testdataprovider")
public void testMethod(String test1, String test2, String test3){}

Aucun commentaire:

Enregistrer un commentaire