01: package org.junit.runner;
02:
03: import org.junit.runner.notification.RunNotifier;
04:
05: /**
06: * A <code>Runner</code> runs tests and notifies a {@link org.junit.runner.notification.RunNotifier}
07: * of significant events as it does so. You will need to subclass <code>Runner</code>
08: * when using {@link org.junit.runner.RunWith} to invoke a custom runner. When creating
09: * 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 {
22: /**
23: * @return a {@link Description} showing the tests to be run by the receiver
24: */
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: */
32: public abstract void run(RunNotifier notifier);
33:
34: /**
35: * @return the number of tests to be run by the receiver
36: */
37: public int testCount() {
38: return getDescription().testCount();
39: }
40: }
|