All test methods in JUnit are performed by the Test Runner. JUnit unit tests provide a default test runner Blockjunit4classrunner, but there is no restriction that the default runner must be used.
We can customize our own running device as needed, as long as we inherit from Org.junit.runner.Runner. In general, the default test runner can handle most of the unit test requirements. When using some of the advanced features provided by JUnit, such as implementing parametric testing, implementing packaged tests, or customizing JUnit testing for special needs, you need to declare the test runner as a display. such as @runwith (Customertestrunner.class). Import static org.junit.assert.*; Import Org.junit.Test; Import Org.junit.runner.RunWith; Import Org.junit.runners.Suite; Import org.junit.runners.Suite.SuiteClasses; /** * @author Chris * * */@RunWith (Suite.class) @SuiteClasses ({junitexceptiontest.class,junit4parametertest.class, Junittimeouttest.class}) public class Junit4suitetest {@Test public void AllTest () {assertnotnull (null); }} JUnit provides us with the ability to package tests, centralizes all test cases that need to run, and runs all test cases at once, greatly facilitating our testing efforts.
Specify a suite test runner with @runwith annotations, and also package all the use cases that need to be tested by @suiteclasses annotations.
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.