Book Image

Testing with JUnit

By : Leonard Przybylski, Frank Appel
Book Image

Testing with JUnit

By: Leonard Przybylski, Frank Appel

Overview of this book

Table of Contents (16 chapters)
Testing with JUnit
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using custom runners


This section will introduce different extensions that are helpful for structuring your test universe. Further, we'll shed some light on the consequences of overdone runner usage.

Furnishing a suite with test cases

Probably one of the best known runners is Suite. Its purpose is to compose several test cases and/or other suites into a single entity that is processable by JUnit, which allows an example to combine all test cases of a subsystem. This might be an appropriate excerpt with respect to the overall test execution duration on your local machine—if you're about to enhance some of the subsystem's capabilities.

The suite-defining class has normally no body implementation. The composition is accomplished by means of the @SuiteClasses annotation, which is used to specify a list of test cases or nested suites:

@RunWith( Suite.class )
@SuiteClasses( {
  TimelineTest.class,
  UiITest.class,
  [...]
} )
public class AllTestSuite {}

The AllTestSuite example illustrates how to...