Here I am assigning data
public static Object[][][] SiteUrlForSignin = {
{{"https://google.com"},{"username"},{"mypassword"}}
};
Here is my test class
public class SignInTest{
@DataProvider(name = "SigninLink")
public Object[][] getData() {
Object[][][] data = SiteConfig.SiteUrlForSignin;
return data;
}
@Test(priority = 1, alwaysRun = true, dataProvider = "SigninLink")
public void mytest(String url,String username,String password,Method method,ITestContext ctx) throws InterruptedException, IOException {
System.out.println(url+"-"+username+"-"+password);
}
}
Getting following error
has no parameters defined but was found to be using a data provider (either explicitly specified or inherited from class level annotation). Data provider mismatch
I am not sure where I missed
There are few issues in the code.
{"https://google.com","username","mypassword"}
SiteUrlForSignin
is a 3-d array. Convert it as:public static Object[][] SiteUrlForSignin = {{"https://google.com","username","mypassword"}};
Note: According to the documentation, you cannot inject Method
into a method annotated with @Test
. It is applicable only to @BeforeMethod
, @AfterMethod
and @DataProvider
, But it is possible now :-)
Not sure if it is a bug or if the documentation is not updated.