Previously a single individual program test, which is possible when the test analogy is low,
But the test class is much, a single single test method is not recommended, it must use a composite test
A testsuite is a composite test. It runs the set of test cases. The test procedure is to test all the test programs of a package without a single individual test
Specific code:
[Java]View plain copy
- Package com.junit3_8;
- Import Junit.framework.Test;
- Import Junit.framework.TestCase;
- Import Junit.framework.TestSuite;
- /**
- * A testsuite is a composite test. It runs the set of test cases.
- *
- */
- Public class Testall extends testcase{
- //Remember that the method is static and has a return value
- public Static Test Suite ()
- {
- TestSuite ts = new TestSuite ();
- //These clearly take advantage of the reflection
- Ts.addtestsuite (calculatortest. Class);
- Ts.addtestsuite (recursiondeletefiledemotest. Class);
- return TS;
- }
- }
JUnit 3.8 enables all test programs to implement composite testing (TestSuite)