org.junit.Assert.
has deprecated junit.framework.Assert
My question is how do I create a Test Suite in Eclipse if my JUnit classes do not extend a TestCase
?
When I try to create new Test Suite in Eclipse my classes do not appear in the select box and I imagine this is because they don't extend a TestCase
.
I thought that with the new org.junit
I can just use annotation and not extend TestCase
The following code will create a test suite with Junit4. You can then just run this in Eclipse as a Junit test case. Obviously the TestClasses need to contain methods annotated with @Test otherwise no tests will actually run for the suite.
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({TestClass1.class, TestClass2.class})
public class TestSuite {
//nothing
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With