Commonly the parameters for the test method are as follows
@Test //Test method (dataProvider="login")
public void TestCase1(String field1, String field2)
{
driver.findElement(By.xpath("//[@id='username']")).sendKeys(field1);
driver.findElement(By.xpath("//[@id='password']")).sendKeys(field2);
}
The result is click on this image
Instead of specific (String field1, String field2)
as the paremeters, is it possible for me to use array as the parameters (String[] fields)
? (please see the code below)
@Test //Test method (dataProvider="login")
public void TestCase1(String[] fields)
{
driver.findElement(By.xpath("//[@id='username']")).sendKeys(field[0]);
driver.findElement(By.xpath("//[@id='password']")).sendKeys(field[1]);
}
The result is click on this image
From the results, there is slightly difference in terms of the formatting.
My question is does the both of the methods produce the same meaning?