I have test class as shown below that uses hardcoded parameters in input
function to initialize tests:
@RunWith(Parameterized.class)
public class Test1 extends JUnitXMLReporter {
private String name, id, platform, version;
private Test1 test;
public Test1(String name, String id, String platform, String version){
//super();
this.name = name;
this.id = id;
this.platform = platform;
this.version = version;
}
@Test
//Login as test user | start menu | logout
public void testLoginLogout() {
[...]
}
@Before
public void initialize() {
test = new Test1(name, id, platform, version);
}
@Parameterized.Parameters
public static String[][] input() {
return new String[][]{{"Nexus 5X API 24", "emulator-5554", "Android", "7.0"},
{"Nexus 5X API 26", "emulator-5556", "Android", "8.0"}};
}
}
I know that I can call this class so Result result = JUnitCore.runClasses(new ParallelComputer(false, true), Test1.class);
to run @Test in parallel for hardcoded parameters. Now I want to change it so now hardcoded information is read from file and preferably passed from main
So preferably main would read XML file to get info, put it in array and pass to Test class. How can I achieve that?