LogcatCrashResultForwarder

public class LogcatCrashResultForwarder
extends ResultForwarder

java.lang.Object
   ↳ com.android.tradefed.result.ResultForwarder
     ↳ com.android.tradefed.result.LogcatCrashResultForwarder


Special listener: on failures (instrumentation process crashing) it will attempt to extract from the logcat the crash and adds it to the failure message associated with the test.

Summary

Constants

int MAX_NUMBER_CRASH

Fields

public static final String ERROR_MESSAGE

Special error message from the instrumentation when something goes wrong on device side.

Public constructors

LogcatCrashResultForwarder(ITestDevice device, ITestInvocationListener... listeners)

Public methods

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 testFailed(TestDescription test, String trace)

Reports the failure of a individual test case.

void testRunEnded(long elapsedTime, runMetrics)

Reports end of test run.

void testRunFailed(String errorMessage)

Reports test run failed to complete due to a fatal error.

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.

Constants

MAX_NUMBER_CRASH

public static final int MAX_NUMBER_CRASH

Constant Value: 3 (0x00000003)

Fields

ERROR_MESSAGE

public static final String ERROR_MESSAGE

Special error message from the instrumentation when something goes wrong on device side.

Public constructors

LogcatCrashResultForwarder

public LogcatCrashResultForwarder (ITestDevice device, 
                ITestInvocationListener... listeners)

Parameters
device ITestDevice

listeners ITestInvocationListener

Public methods

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

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 elapsedTime, 
                 runMetrics)

Reports end of test run. FIXME: We cannot have two Map<> interfaces with different type, so we have to use HashMap here.

Parameters
elapsedTime long: device reported elapsed time, in milliseconds

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

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.

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