How can I add an instance of test case into junit4 test suite without annotation/class
質問
I have some test casees declared following JUnit4 annotation @Test like below:
public class SampleTest {
@Test
public void execute() {
}
}
And I define a test suite declared like below:
public class FacadeMockTestSuite extends TestSuite {
public static Test suite() {
TestSuite suite = new TestSuite("My Test");
// ...
return suite;
}
}
When I tried to add my test case into the suite, I found I can only use the class of the case, through either @SuiteClass or suite.addTest(new JUnit4TestAdapter(myTestClass));
But how can I directly insert a test case instance created by myself into the suite? Since I need to scan test case classes in my runtime and create them with non-default constructor?
正しい解決策はありません
所属していません StackOverflow