In Junit 4.11, how can I add individual test cases into a test suite? This allows me to select some but not necessarily all of the test cases defined in a test case class, to create and run.
For comparison, in JUnit 3.8, https://www.oreilly.com/library/view/java-extreme-programming/0596003870/ch04s08.html describes a way to add individual test cases into a test suite:
public class TestGame extends TestCase {
...
public static Test suite( ) {
return new TestSuite(TestGame.class);
}
}
public static Test suite( ) {
TestSuite suite = new TestSuite( );
// To use this idiom, you must define the String constructor in your
// TestGame class. Remember that JUnit 3.8 made that constructor optional.
suite.addTest(new TestGame("testCreateFighter"));
suite.addTest(new TestGame("testSameFighters"));
return suite;
}
Thanks.
Aucun commentaire:
Enregistrer un commentaire