public class InstrumentationResultParser extends MultiLineReceiver
Expects the following output:
If fatal error occurred when attempted to run the tests:
INSTRUMENTATION_STATUS: Error=error Message INSTRUMENTATION_FAILED:
or
INSTRUMENTATION_RESULT: shortMsg=error Message
Otherwise, expect a series of test results, each one containing a set of status key/value pairs, delimited by a start(1)/pass(0)/fail(-2)/error(-1) status code result. At end of test run, expects that the elapsed test time in seconds will be displayed
For example:
INSTRUMENTATION_STATUS_CODE: 1
INSTRUMENTATION_STATUS: class=com.foo.FooTest
INSTRUMENTATION_STATUS: test=testFoo
INSTRUMENTATION_STATUS: numtests=2
INSTRUMENTATION_STATUS: stack=com.foo.FooTest#testFoo:312
com.foo.X
INSTRUMENTATION_STATUS_CODE: -2
...
Time: X
Note that the "value" portion of the key-value pair may wrap over several text lines
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
INVALID_OUTPUT_ERR_MSG
Error message supplied when the test run output doesn't contain a valid time stamp.
|
| Constructor and Description |
|---|
InstrumentationResultParser(java.lang.String runName,
java.util.Collection<ITestRunListener> listeners)
Creates the InstrumentationResultParser.
|
InstrumentationResultParser(java.lang.String runName,
ITestRunListener listener)
Creates the InstrumentationResultParser for a single listener.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Requests cancellation of test run.
|
void |
done()
Called by parent when adb session is complete.
|
void |
handleTestRunFailed(java.lang.String errorMsg)
Inform the parser of a instrumentation run failure.
|
boolean |
isCancelled()
Returns true if test run canceled.
|
void |
processNewLines(java.lang.String[] lines)
Processes the instrumentation test output from shell.
|
void |
setEnforceTimeStamp(boolean isEnforced)
Set to True to enforce searching for a final time stamp, and fail the run if missing.
|
addOutput, flush, setTrimLinepublic static final java.lang.String INVALID_OUTPUT_ERR_MSG
public InstrumentationResultParser(java.lang.String runName,
java.util.Collection<ITestRunListener> listeners)
runName - the test run name to provide to
ITestRunListener.testRunStarted(String, int)listeners - informed of test results as the tests are executingpublic InstrumentationResultParser(java.lang.String runName,
ITestRunListener listener)
runName - the test run name to provide to
ITestRunListener.testRunStarted(String, int)listener - informed of test results as the tests are executingpublic void processNewLines(@NonNull
java.lang.String[] lines)
processNewLines in class MultiLineReceiverlines - The array containing the new lines.MultiLineReceiver.processNewLines(java.lang.String[])public boolean isCancelled()
IShellOutputReceiver.isCancelled()public void cancel()
public void handleTestRunFailed(java.lang.String errorMsg)
public void done()
done in class MultiLineReceiverpublic void setEnforceTimeStamp(boolean isEnforced)