summaryrefslogtreecommitdiffstats
path: root/junit4/src/main/java/org/junit/runner/Runner.java
blob: 39e424f83ac7c51541376afbfd1d1aa563633648 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package org.junit.runner;

import org.junit.runner.notification.RunNotifier;

/**
 * A <code>Runner</code> runs tests and notifies a {@link org.junit.runner.notification.RunNotifier}
 * of significant events as it does so. You will need to subclass <code>Runner</code>
 * when using {@link org.junit.runner.RunWith} to invoke a custom runner. When creating
 * a custom runner, in addition to implementing the abstract methods here you must
 * also provide a constructor that takes as an argument the {@link Class} containing
 * the tests.
 * <p/>
 * The default runner implementation guarantees that the instances of the test case
 * class will be constructed immediately before running the test and that the runner
 * will retain no reference to the test case instances, generally making them 
 * available for garbage collection.
 * 
 * @see org.junit.runner.Description
 * @see org.junit.runner.RunWith
 */
public abstract class Runner implements Describable {
	/* (non-Javadoc)
	 * @see org.junit.runner.Describable#getDescription()
	 */
	public abstract Description getDescription();

	/**
	 * Run the tests for this runner.
	 * @param notifier will be notified of events while tests are being run--tests being 
	 * started, finishing, and failing
	 */
	public abstract void run(RunNotifier notifier);
	
	/**
	 * @return the number of tests to be run by the receiver
	 */
	public int testCount() {
		return getDescription().testCount();
	}
}