ModuleResultsAndMetricsForwarder

public class ModuleResultsAndMetricsForwarder
extends ResultAndLogForwarder

java.lang.Object
   ↳ com.android.tradefed.result.ResultForwarder
     ↳ com.android.tradefed.result.ResultAndLogForwarder
       ↳ com.android.tradefed.result.ModuleResultsAndMetricsForwarder


An Extension of ResultAndLogForwarder that adds extra module related metrics to the test results.

Summary

Public constructors

ModuleResultsAndMetricsForwarder(ITestInvocationListener... listeners)

Public methods

void setAttemptIsolation(CurrentInvocation.IsolationGrade isolation)

Sets whether or not the attempt should be reported as isolated.

void setModuleId(String moduleId)
void setTestMappingSources( testMappingSources)

Sets test-mapping sources that will be inserted into metrics.

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.

void testEnded(TestDescription test, testMetrics)

Reports the execution end of an individual test case.

void testFailed(TestDescription test, FailureDescription failure)

Reports the failure of a individual test case.

void testFailed(TestDescription test, String trace)

Reports the failure of a individual test case.

void testRunEnded(long elapsedTimeMillis, runMetrics)

Reports end of test run.

void testRunFailed(FailureDescription failure)

Reports test run failed to complete due to a failure described by FailureDescription.

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.

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.

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.

void testStarted(TestDescription test)

Reports the start of an individual test case.

Public constructors

ModuleResultsAndMetricsForwarder

public ModuleResultsAndMetricsForwarder (ITestInvocationListener... listeners)

Parameters
listeners ITestInvocationListener

Public methods

setAttemptIsolation

public void setAttemptIsolation (CurrentInvocation.IsolationGrade isolation)

Sets whether or not the attempt should be reported as isolated.

Parameters
isolation CurrentInvocation.IsolationGrade

setModuleId

public void setModuleId (String moduleId)

Parameters
moduleId String

setTestMappingSources

public void setTestMappingSources ( testMappingSources)

Sets test-mapping sources that will be inserted into metrics.

Parameters
testMappingSources

testEnded

public 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 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 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

testRunEnded

public void testRunEnded (long elapsedTimeMillis, 
                 runMetrics)

Reports end of test run.

Parameters
elapsedTimeMillis long: device reported elapsed time, in milliseconds

runMetrics : key-value pairs reported at the end of a test run

testRunFailed

public 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 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 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()

testStarted

public 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 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