Interface Runner
-
public interface RunnerRepresents one run of a suite of tests.The run represented by a
Runnerhas a lifecycle. The run begins when theRunneris instantiated by the framework and returned to the client during aFramework.runnerinvocation. The run continues until the client invokesdoneon theRunner. Before invokingdone, the client can invoke thetasksmethod as many times at it wants, but oncedonehas been invoked, theRunnerenters "spent" mode. Any subsequent invocations oftaskswill be met with anIllegalStateException.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String[]args()Returns thge arguments that were used to create thisRunner.java.lang.Stringdone()Indicates the client is done with thisRunnerinstance.java.lang.String[]remoteArgs()Remote args that will be passed toRunnerin a sub-process as remoteArgs.Task[]tasks(TaskDef[] taskDefs)Returns an array of tasks that when executed will run tests and suites determined by the passedTaskDefs.
-
-
-
Method Detail
-
tasks
Task[] tasks(TaskDef[] taskDefs)
Returns an array of tasks that when executed will run tests and suites determined by the passedTaskDefs.Each returned task, when executed, will run tests and suites determined by the test class name, fingerprints, "explicitly specified" field, and selectors of one of the passed
TaskDefs.This
tasksmethod may be called withTaskDefs containing the same value fortestClassNamebut different fingerprints. For example, if both a class and its companion object were test classes, thetasksmethod could be passed an array containingTaskDefs with the same name but with a different value forfingerprint.isModule.A test framework may "reject" a requested task by returning no
Taskfor thatTaskDef.- Parameters:
taskDefs- theTaskDefs for requested tasks- Returns:
- an array of
Tasks - Throws:
java.lang.IllegalStateException- if invoked afterdonehas been invoked.
-
done
java.lang.String done()
Indicates the client is done with thisRunnerinstance.After invoking the
donemethod on aRunnerinstance, the client should no longer invoke thetaskmethods on that instance. (If the client does invoketaskafterdone, it will be rewarded with anIllegalStateException.)Similarly, after returning from
done, the test framework should no longer write any messages to theLogger, nor fire any more events to theEventHandler, passed toFramework.runner. If the test framework has not completed writing log messages or firing events when the client invokesdone, the framework should not return fromdoneuntil it is finished sending messages and events, and may block the thread that invokeddoneuntil it is actually done.In short, by invoking
done, the client indicates it is done invoking thetaskmethods for this run. By returning fromdone, the test framework indicates it is done writing log messages and firing events for this run.If the client invokes
donemore than once on the sameRunnerinstance, the test framework should on subsequent invocations should throwIllegalStateException.The test framework may send a summary (i.e., a message giving total tests succeeded, failed, and so on) to the user via a log message. If so, it should return the summary from
done. If not, it should return an empty string. The client may use the return value ofdoneto decide whether to display its own summary message.The test framework may return a multi-lines string (i.e., a message giving total tests succeeded, failed and so on) to the client.
- Returns:
- a possibly multi-line summary string, or the enpty string if no summary is provided
-
remoteArgs
java.lang.String[] remoteArgs()
Remote args that will be passed toRunnerin a sub-process as remoteArgs.- Returns:
- an array of strings that will be passed to
Runnerin a sub-process asremoteArgs.
-
args
java.lang.String[] args()
Returns thge arguments that were used to create thisRunner.- Returns:
- an array of argument that is used to create this Runner.
-
-