• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.junit.runner;
2 
3 import org.junit.runner.notification.RunNotifier;
4 
5 /**
6  * A <code>Runner</code> runs tests and notifies a {@link org.junit.runner.notification.RunNotifier}
7  * of significant events as it does so. You will need to subclass <code>Runner</code>
8  * when using {@link org.junit.runner.RunWith} to invoke a custom runner. When creating
9  * a custom runner, in addition to implementing the abstract methods here you must
10  * also provide a constructor that takes as an argument the {@link Class} containing
11  * the tests.
12  * <p/>
13  * The default runner implementation guarantees that the instances of the test case
14  * class will be constructed immediately before running the test and that the runner
15  * will retain no reference to the test case instances, generally making them
16  * available for garbage collection.
17  *
18  * @see org.junit.runner.Description
19  * @see org.junit.runner.RunWith
20  */
21 public abstract class Runner implements Describable {
22 	/* (non-Javadoc)
23 	 * @see org.junit.runner.Describable#getDescription()
24 	 */
getDescription()25 	public abstract Description getDescription();
26 
27 	/**
28 	 * Run the tests for this runner.
29 	 * @param notifier will be notified of events while tests are being run--tests being
30 	 * started, finishing, and failing
31 	 */
run(RunNotifier notifier)32 	public abstract void run(RunNotifier notifier);
33 
34 	/**
35 	 * @return the number of tests to be run by the receiver
36 	 */
testCount()37 	public int testCount() {
38 		return getDescription().testCount();
39 	}
40 }