Question

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?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top