I'm using @Parameter for Field injection while writing a JUNIT test. Is it possible to pass a String array to the data object[][]. I mean in the below code can I pass a string array like this
{"Input1","Input2", {"file1","file2"}}
Code Snippet
@RunWith(Parameterized.class)
public class AModuleTest {
@Parameters
public static Iterable<Object[]> testData() {
Object[][] data = new Object[][]{
{"Input1","Input2", }
};
return Arrays.asList(data);
}
@Parameter(value=0) public String tabName;
@Parameter(value=1) public String fileSetName;
@Parameter(value=2) public String[] fileNames
@Test
public void ATest(){
//here I'm just passing those parameters to these functions clickTab, Navigate()...
clickTab(tabName);
Navigate(fileSet);
}
}
So I figured that we can create an array within arrays; by creating a String array within the data Object like
Object[][] data = new Object[][]{
{"Input1","Input2", new String[] {"file1", "file2"} }
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.