I am writting jnuit test case for testing API.
my class is as follows
class MyTest extends TestCase{
List<String> argList;
public MyTest(){
//read argList from File
}
testMyTest(){
//callmy api
myApi(arg1);
}
}
Now i want make a seperate testcase for each of the 50 args.Args are read from File. I dont want to write a seperate method for calling myApi with different args.How can i do it?
I dont want to write sperate methods like
testMyTest1(){
//callmy api
myApi(arg1);
}
testMyTest1(){
//callmy api
myApi(arg2);
}
You can use a Parameterized tests or Theories (since JUnit 4.4). For more details use