JUnit 3.8 enables all test programs to implement composite testing (TestSuite)

Source: Internet
Author: User

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
  1. Package com.junit3_8;
  2. Import Junit.framework.Test;
  3. Import Junit.framework.TestCase;
  4. Import Junit.framework.TestSuite;
  5. /**
  6. * A testsuite is a composite test. It runs the set of test cases.
  7. *
  8. */
  9. Public class Testall extends testcase{
  10. //Remember that the method is static and has a return value
  11. public Static Test Suite ()
  12. {
  13. TestSuite ts = new TestSuite ();
  14. //These clearly take advantage of the reflection
  15. Ts.addtestsuite (calculatortest.   Class);
  16. Ts.addtestsuite (recursiondeletefiledemotest.   Class);
  17. return TS;
  18. }
  19. }

JUnit 3.8 enables all test programs to implement composite testing (TestSuite)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.