Interface Runner
The run represented by a Runner
has a lifecycle. The run begins when the
Runner
is instantiated by the framework and returned to the client during
a Framework.runner
invocation. The run continues until the client
invokes done
on the Runner
. Before invoking done
,
the client can invoke the tasks
method as many times at it wants, but once
done
has been invoked, the Runner
enters "spent" mode. Any
subsequent invocations of tasks
will be met with an
IllegalStateException
.
-
Method Summary
Modifier and TypeMethodDescriptionString[]
args()
Returns thge arguments that were used to create thisRunner
.done()
Indicates the client is done with thisRunner
instance.String[]
Remote args that will be passed toRunner
in a sub-process as remoteArgs.Task[]
Returns an array of tasks that when executed will run tests and suites determined by the passedTaskDef
s.
-
Method Details
-
tasks
Returns an array of tasks that when executed will run tests and suites determined by the passedTaskDef
s.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
TaskDef
s.This
tasks
method may be called withTaskDef
s containing the same value fortestClassName
but different fingerprints. For example, if both a class and its companion object were test classes, thetasks
method could be passed an array containingTaskDef
s with the same name but with a different value forfingerprint.isModule
.A test framework may "reject" a requested task by returning no
Task
for thatTaskDef
.- Parameters:
taskDefs
- theTaskDef
s for requested tasks- Returns:
- an array of
Task
s - Throws:
IllegalStateException
- if invoked afterdone
has been invoked.
-
done
String done()Indicates the client is done with thisRunner
instance.After invoking the
done
method on aRunner
instance, the client should no longer invoke thetask
methods on that instance. (If the client does invoketask
afterdone
, 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 fromdone
until it is finished sending messages and events, and may block the thread that invokeddone
until it is actually done.In short, by invoking
done
, the client indicates it is done invoking thetask
methods 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
done
more than once on the sameRunner
instance, 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 ofdone
to 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
String[] remoteArgs()Remote args that will be passed toRunner
in a sub-process as remoteArgs.- Returns:
- an array of strings that will be passed to
Runner
in a sub-process asremoteArgs
.
-
args
String[] args()Returns thge arguments that were used to create thisRunner
.- Returns:
- an array of argument that is used to create this Runner.
-