ProtoResultReporter
public
abstract
class
ProtoResultReporter
extends Object
implements
ILogSaverListener,
ISupportGranularResults,
ITestInvocationListener
java.lang.Object | |
↳ | com.android.tradefed.result.proto.ProtoResultReporter |
Result reporter build a TestRecord
protobuf with all the results inside. Should be
extended to handle what to do with the final proto in processFinalProto(com.android.tradefed.result.proto.TestRecordProto.TestRecord)
.
Summary
Public constructors | |
---|---|
ProtoResultReporter()
|
Public methods | |
---|---|
final
void
|
invocationEnded(long elapsedTime)
Reports that the invocation has terminated, whether successfully or due to some error condition. |
void
|
invocationFailed(FailureDescription failure)
Reports an incomplete invocation due to some error condition. |
void
|
invocationFailed(Throwable cause)
Reports an incomplete invocation due to some error condition. |
void
|
invocationSkipped(SkipReason reason)
Reports an invocation as skipped |
final
void
|
invocationStarted(IInvocationContext context)
Reports the start of the test invocation. |
final
void
|
logAssociation(String dataName, LogFile logFile)
In some cases, log must be strongly associated with a test cases, but the opportunity to do
so on the direct |
void
|
processFinalInvocationLogs(TestRecordProto.TestRecord invocationLogs)
Use the invocation record to send one by one all the final logs of the invocation. |
void
|
processFinalProto(TestRecordProto.TestRecord finalRecord)
Handling of the final proto with all results. |
void
|
processStartInvocation(TestRecordProto.TestRecord invocationStartRecord, IInvocationContext invocationContext)
Handling of the partial invocation test record proto after |
void
|
processTestCaseEnded(TestRecordProto.TestRecord testCaseRecord)
Handling of the finalized test case record proto after |
void
|
processTestCaseStarted(TestRecordProto.TestRecord testCaseStartedRecord)
Handling of the partial test case record proto after |
void
|
processTestModuleEnd(TestRecordProto.TestRecord moduleRecord)
Handling of the finalized module record proto after |
void
|
processTestModuleStarted(TestRecordProto.TestRecord moduleStartRecord)
Handling of the partial module record proto after |
void
|
processTestRunEnded(TestRecordProto.TestRecord runRecord, boolean moduleInProgress)
Handling of the finalized run record proto after |
void
|
processTestRunStarted(TestRecordProto.TestRecord runStartedRecord)
Handling of the partial test run record proto after |
void
|
setGranularResults(boolean granularResults)
|
void
|
setInlineRecordOfChildren(boolean inline)
|
boolean
|
supportGranularResults()
Returns True if the reporter support granular results, false otherwise. |
final
void
|
testAssumptionFailure(TestDescription test, String trace)
Called when an atomic test flags that it assumes a condition that is false |
final
void
|
testAssumptionFailure(TestDescription test, FailureDescription failure)
Called when an atomic test flags that it assumes a condition that is false |
final
void
|
)">testEnded(TestDescription test, long endTime,
Alternative to |
void
|
)">testEnded(TestDescription test,
Reports the execution end of an individual test case. |
final
void
|
testFailed(TestDescription test, FailureDescription failure)
Reports the failure of a individual test case. |
final
void
|
testFailed(TestDescription test, String trace)
Reports the failure of a individual test case. |
final
void
|
testIgnored(TestDescription test)
Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore. |
final
void
|
testModuleEnded()
Reports the end of a module run. |
final
void
|
testModuleStarted(IInvocationContext moduleContext)
Reports the beginning of a module running. |
final
void
|
)">testRunEnded(long elapsedTimeMillis,
Reports end of test run. |
final
void
|
testRunFailed(FailureDescription failure)
Reports test run failed to complete due to a failure described by |
final
void
|
testRunFailed(String errorMessage)
Reports test run failed to complete due to a fatal error. |
void
|
testRunStarted(String runName, int testCount, int attemptNumber)
Reports the start of a test run. |
final
void
|
testRunStarted(String runName, int testCount)
Reports the start of a test run. |
void
|
testRunStarted(String runName, int testCount, int attemptNumber, long startTime)
Reports the start of a test run. |
final
void
|
testSkipped(TestDescription test, SkipReason reason)
Called when a test is skipped and did not execute for a reason that is not usually expected. |
final
void
|
testStarted(TestDescription test, long startTime)
Alternative to |
final
void
|
testStarted(TestDescription test)
Reports the start of an individual test case. |
Protected methods | |
---|---|
TestRecordProto.ChildReference
|
createModuleChildReference(TestRecordProto.TestRecord record)
Creates a child reference for a module. |
Public constructors
ProtoResultReporter
public ProtoResultReporter ()
Public methods
invocationEnded
public final void invocationEnded (long elapsedTime)
Reports that the invocation has terminated, whether successfully or due to some error condition.
Will be automatically called by the TradeFederation framework.Parameters | |
---|---|
elapsedTime |
long : the elapsed time of the invocation in ms |
invocationFailed
public void invocationFailed (FailureDescription failure)
Reports an incomplete invocation due to some error condition.
Will be automatically called by the TradeFederation framework.
Parameters | |
---|---|
failure |
FailureDescription : the FailureDescription describing the cause of the failure |
invocationFailed
public void invocationFailed (Throwable cause)
Reports an incomplete invocation due to some error condition.
Will be automatically called by the TradeFederation framework.Parameters | |
---|---|
cause |
Throwable : the Throwable cause of the failure |
invocationSkipped
public void invocationSkipped (SkipReason reason)
Reports an invocation as skipped
Parameters | |
---|---|
reason |
SkipReason |
invocationStarted
public final void invocationStarted (IInvocationContext context)
Reports the start of the test invocation.
Will be automatically called by the TradeFederation framework. Reporters need to override this method to support multiple devices reporting.
Parameters | |
---|---|
context |
IInvocationContext : information about the invocation |
logAssociation
public final void logAssociation (String dataName, LogFile logFile)
In some cases, log must be strongly associated with a test cases, but the opportunity to do
so on the direct testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile)
callback is not possible. Thus, this callback allows to provide a strong association
explicitly.
Parameters | |
---|---|
dataName |
String : The name of the data |
logFile |
LogFile : the LogFile that was logged before and should be associated with the
test case. |
processFinalInvocationLogs
public void processFinalInvocationLogs (TestRecordProto.TestRecord invocationLogs)
Use the invocation record to send one by one all the final logs of the invocation.
Parameters | |
---|---|
invocationLogs |
TestRecordProto.TestRecord : The finalized proto representing the invocation. |
processFinalProto
public void processFinalProto (TestRecordProto.TestRecord finalRecord)
Handling of the final proto with all results.
Parameters | |
---|---|
finalRecord |
TestRecordProto.TestRecord : The finalized proto with all the invocation results. |
processStartInvocation
public void processStartInvocation (TestRecordProto.TestRecord invocationStartRecord, IInvocationContext invocationContext)
Handling of the partial invocation test record proto after invocationStarted(com.android.tradefed.invoker.IInvocationContext)
occurred.
Parameters | |
---|---|
invocationStartRecord |
TestRecordProto.TestRecord : The partial proto populated after the invocationStart. |
invocationContext |
IInvocationContext : The invocation IInvocationContext . |
processTestCaseEnded
public void processTestCaseEnded (TestRecordProto.TestRecord testCaseRecord)
Handling of the finalized test case record proto after ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,HashMap))
occurred.
Parameters | |
---|---|
testCaseRecord |
TestRecordProto.TestRecord : The finalized proto representing a test case. |
processTestCaseStarted
public void processTestCaseStarted (TestRecordProto.TestRecord testCaseStartedRecord)
Handling of the partial test case record proto after testStarted(com.android.tradefed.result.TestDescription, long)
occurred.
Parameters | |
---|---|
testCaseStartedRecord |
TestRecordProto.TestRecord : The partial proto representing the test case. |
processTestModuleEnd
public void processTestModuleEnd (TestRecordProto.TestRecord moduleRecord)
Handling of the finalized module record proto after testModuleEnded()
occurred.
Parameters | |
---|---|
moduleRecord |
TestRecordProto.TestRecord : The finalized proto representing the module. |
processTestModuleStarted
public void processTestModuleStarted (TestRecordProto.TestRecord moduleStartRecord)
Handling of the partial module record proto after testModuleStarted(com.android.tradefed.invoker.IInvocationContext)
occurred.
Parameters | |
---|---|
moduleStartRecord |
TestRecordProto.TestRecord : The partial proto representing the module. |
processTestRunEnded
public void processTestRunEnded (TestRecordProto.TestRecord runRecord, boolean moduleInProgress)
Handling of the finalized run record proto after ERROR(/#testRunEnded(long,HashMap))
occurred.
Parameters | |
---|---|
runRecord |
TestRecordProto.TestRecord : The finalized proto representing the run. |
moduleInProgress |
boolean : whether or not a module is in progress. |
processTestRunStarted
public void processTestRunStarted (TestRecordProto.TestRecord runStartedRecord)
Handling of the partial test run record proto after testRunStarted(String, int)
occurred.
Parameters | |
---|---|
runStartedRecord |
TestRecordProto.TestRecord : The partial proto representing the run. |
setGranularResults
public void setGranularResults (boolean granularResults)
Parameters | |
---|---|
granularResults |
boolean |
setInlineRecordOfChildren
public void setInlineRecordOfChildren (boolean inline)
Parameters | |
---|---|
inline |
boolean |
supportGranularResults
public boolean supportGranularResults ()
Returns True if the reporter support granular results, false otherwise.
Returns | |
---|---|
boolean |
testAssumptionFailure
public final void testAssumptionFailure (TestDescription test, String trace)
Called when an atomic test flags that it assumes a condition that is false
Parameters | |
---|---|
test |
TestDescription : identifies the test |
trace |
String : stack trace of failure |
testAssumptionFailure
public final void testAssumptionFailure (TestDescription test, FailureDescription failure)
Called when an atomic test flags that it assumes a condition that is false
Parameters | |
---|---|
test |
TestDescription : identifies the test |
failure |
FailureDescription : FailureDescription describing the failure and its context. |
testEnded
public final void testEnded (TestDescription test, long endTime,testMetrics)
Alternative to ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map))
where we can specify the end time
directly. Combine with testStarted(com.android.tradefed.result.TestDescription, long)
for accurate measure.
Parameters | |
---|---|
test |
TestDescription : identifies the test |
endTime |
long : the time the test ended, measured via System.currentTimeMillis() |
testMetrics |
: a ERROR(/Map) of the metrics emitted |
testEnded
public void testEnded (TestDescription test,testMetrics)
Reports the execution end of an individual test case.
If testFailed(TestDescription, FailureDescription)
was not invoked, this test passed. Also returns any key/value
metrics which may have been emitted during the test case's execution.
Parameters | |
---|---|
test |
TestDescription : identifies the test |
testMetrics |
: a ERROR(/Map) of the metrics emitted |
testFailed
public final void testFailed (TestDescription test, FailureDescription failure)
Reports the failure of a individual test case.
Will be called between testStarted and testEnded.
Parameters | |
---|---|
test |
TestDescription : identifies the test |
failure |
FailureDescription : FailureDescription describing the failure and its context. |
testFailed
public final void testFailed (TestDescription test, String trace)
Reports the failure of a individual test case.
Will be called between testStarted and testEnded.
Parameters | |
---|---|
test |
TestDescription : identifies the test |
trace |
String : stack trace of failure |
testIgnored
public final void testIgnored (TestDescription test)
Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore.
Parameters | |
---|---|
test |
TestDescription : identifies the test |
testModuleEnded
public final void testModuleEnded ()
Reports the end of a module run.
testModuleStarted
public final void testModuleStarted (IInvocationContext moduleContext)
Reports the beginning of a module running. This callback is associated with testModuleEnded()
and is optional in the sequence. It is only used during a run that uses
modules: suite based runners.
Parameters | |
---|---|
moduleContext |
IInvocationContext : the IInvocationContext of the module. |
testRunEnded
public final void testRunEnded (long elapsedTimeMillis,runMetrics)
Reports end of test run. FIXME: We cannot have two Map<> interfaces with different type, so we have to use HashMap here.
Parameters | |
---|---|
elapsedTimeMillis |
long : device reported elapsed time, in milliseconds |
runMetrics |
: key-value pairs reported at the end of a test run with Metric . |
testRunFailed
public final void testRunFailed (FailureDescription failure)
Reports test run failed to complete due to a failure described by FailureDescription
.
Parameters | |
---|---|
failure |
FailureDescription : FailureDescription describing the failure and its context. |
testRunFailed
public final void testRunFailed (String errorMessage)
Reports test run failed to complete due to a fatal error.
Parameters | |
---|---|
errorMessage |
String : String describing reason for run failure. |
testRunStarted
public void testRunStarted (String runName, int testCount, int attemptNumber)
Reports the start of a test run.
Parameters | |
---|---|
runName |
String : the test run name |
testCount |
int : total number of tests in test run |
attemptNumber |
int : order number, identifying the different attempts of the same runName
that run multiple times. The attemptNumber is 0-indexed and should increment everytime
a new run happens. e.g. A test is granular retried 3 times, it should have 4 total
runs under the same runName and the attemptNumber is from 0 to 3. |
testRunStarted
public final void testRunStarted (String runName, int testCount)
Reports the start of a test run.
Parameters | |
---|---|
runName |
String : the test run name |
testCount |
int : total number of tests in test run |
testRunStarted
public void testRunStarted (String runName, int testCount, int attemptNumber, long startTime)
Reports the start of a test run.
Parameters | |
---|---|
runName |
String : the test run name |
testCount |
int : total number of tests in test run |
attemptNumber |
int : order number, identifying the different attempts of the same runName
that run multiple times. The attemptNumber is 0-indexed and should increment everytime a
new run happens. e.g. A test is granular retried 3 times, it should have 4 total runs
under the same runName and the attemptNumber is from 0 to 3. |
startTime |
long : the time the run started, measured via System.currentTimeMillis() |
testSkipped
public final void testSkipped (TestDescription test, SkipReason reason)
Called when a test is skipped and did not execute for a reason that is not usually expected. These tests will be attempted to be retried to attempt to get a proper execution.
Parameters | |
---|---|
test |
TestDescription : identifies the test |
reason |
SkipReason : SkipReason |
testStarted
public final void testStarted (TestDescription test, long startTime)
Alternative to testStarted(com.android.tradefed.result.TestDescription)
where we also specify when the test was
started, combined with ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map))
for accurate measure.
Parameters | |
---|---|
test |
TestDescription : identifies the test |
startTime |
long : the time the test started, measured via System.currentTimeMillis() |
testStarted
public final void testStarted (TestDescription test)
Reports the start of an individual test case. Older interface, should use testStarted(com.android.tradefed.result.TestDescription)
whenever possible.
Parameters | |
---|---|
test |
TestDescription : identifies the test |
Protected methods
createModuleChildReference
protected TestRecordProto.ChildReference createModuleChildReference (TestRecordProto.TestRecord record)
Creates a child reference for a module.
Parameters | |
---|---|
record |
TestRecordProto.TestRecord |
Returns | |
---|---|
TestRecordProto.ChildReference |