I am writing the below code in selenium and below error is showing, please let me know where is the issue.
import org.testng.annotations.DataProvider; import org.testng.
The only problem I see is this, You are reading from excel so may be all the values are coming in String
, unless you are converting that to Integer
. However, in your test you expect third argument age
to be Integer
Changing type to String
should resolve the issue
@Test(dataProvider = "newdata")
public void testData(String username, String password, String age) {
System.out.println(username + " - " + password + " - " + age);
}
The following code would raise the same error.
@DataProvider(name = "newdata")
public static Object[][] getData() {
return new Object[][]{
{"20"},
{"30"}
};
}
@Test(dataProvider = "newdata")
public void testData(Integer age) {
System.out.println(age);
}