Google is committed to advancing racial equity for Black communities. See how.

BugreportCollector

public class BugreportCollector
extends Object implements ITestInvocationListener

java.lang.Object
   ↳ com.android.tradefed.result.BugreportCollector


A pass-through ITestInvocationListener that collects bugreports when configurable events occur and then calls ITestInvocationListener#testLog on its children after each bugreport is collected.

Behaviors: (FIXME: finish this)

  • Capture after each if any testcases failed
  • Capture after each testcase
  • Capture after each failed testcase
  • Capture

Summary

Nested classes

enum BugreportCollector.Filter

 

enum BugreportCollector.Freq

 

enum BugreportCollector.Noun

 

class BugreportCollector.Predicate

A full predicate describing when to capture a bugreport. 

enum BugreportCollector.Relation

 

interface BugreportCollector.SubPredicate

 

Fields

public static final BugreportCollector.Predicate AFTER_FAILED_TESTCASES

A predefined predicate which fires after each failed testcase

public static final BugreportCollector.Predicate AT_START

A predefined predicate which fires as the first invocation begins

Public constructors

BugreportCollector(ITestInvocationListener listener, ITestDevice testDevice)

Public methods

void addPredicate(BugreportCollector.Predicate p)
void blockUntilIdle()

Block until the collector is not collecting any bugreports.

TestSummary getSummary()

void invocationEnded(long elapsedTime)

void invocationFailed(Throwable cause)

void invocationStarted(IInvocationContext context)

void setAsynchronous(boolean asynchronous)

Set whether bugreport collection should collect the bugreport in a different thread (asynchronous = true), or block the caller until the bugreport is captured (asynchronous = false).

void setDescriptiveName(String name)

Set the descriptive name to use when recording bugreports.

void setDeviceWaitTime(int waitTime)

Set the time (in seconds) to wait for the device to be Online before we try to capture a bugreport.

void testAssumptionFailure(TestDescription test, String trace)

void testEnded(TestDescription test, testMetrics)
void testFailed(TestDescription test, String trace)

void testIgnored(TestDescription test)
void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)

void testRunEnded(long elapsedTime, runMetrics)

void testRunFailed(String errorMessage)

void testRunStarted(String runName, int testCount)

void testRunStopped(long elapsedTime)

void testStarted(TestDescription test)

Fields

AFTER_FAILED_TESTCASES

public static final BugreportCollector.Predicate AFTER_FAILED_TESTCASES

A predefined predicate which fires after each failed testcase

AT_START

public static final BugreportCollector.Predicate AT_START

A predefined predicate which fires as the first invocation begins

Public constructors

BugreportCollector

public BugreportCollector (ITestInvocationListener listener, 
                ITestDevice testDevice)

Parameters
listener ITestInvocationListener

testDevice ITestDevice

Public methods

addPredicate

public void addPredicate (BugreportCollector.Predicate p)

Parameters
p BugreportCollector.Predicate

blockUntilIdle

public void blockUntilIdle ()

Block until the collector is not collecting any bugreports. If the collector isn't actively collecting a bugreport, return immediately

getSummary

public TestSummary getSummary ()

Returns
TestSummary

invocationEnded

public void invocationEnded (long elapsedTime)

Parameters
elapsedTime long

invocationFailed

public void invocationFailed (Throwable cause)

Parameters
cause Throwable

invocationStarted

public void invocationStarted (IInvocationContext context)

Parameters
context IInvocationContext

setAsynchronous

public void setAsynchronous (boolean asynchronous)

Set whether bugreport collection should collect the bugreport in a different thread (asynchronous = true), or block the caller until the bugreport is captured (asynchronous = false).

Parameters
asynchronous boolean

setDescriptiveName

public void setDescriptiveName (String name)

Set the descriptive name to use when recording bugreports. If null, BugreportCollector will fall back to the default behavior of serializing the name of the event that caused the bugreport to be collected.

Parameters
name String

setDeviceWaitTime

public void setDeviceWaitTime (int waitTime)

Set the time (in seconds) to wait for the device to be Online before we try to capture a bugreport. If negative, no check will be performed. Any DeviceNotAvailableException encountered during this check will be logged and ignored.

Parameters
waitTime int

testAssumptionFailure

public void testAssumptionFailure (TestDescription test, 
                String trace)

Parameters
test TestDescription

trace String

testEnded

public void testEnded (TestDescription test, 
                 testMetrics)

Parameters
test TestDescription

testMetrics

testFailed

public void testFailed (TestDescription test, 
                String trace)

Parameters
test TestDescription

trace String

testIgnored

public void testIgnored (TestDescription test)

Parameters
test TestDescription

testLog

public void testLog (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream)

Parameters
dataName String

dataType LogDataType

dataStream InputStreamSource

testRunEnded

public void testRunEnded (long elapsedTime, 
                 runMetrics)

Parameters
elapsedTime long

runMetrics

testRunFailed

public void testRunFailed (String errorMessage)

Parameters
errorMessage String

testRunStarted

public void testRunStarted (String runName, 
                int testCount)

Parameters
runName String

testCount int

testRunStopped

public void testRunStopped (long elapsedTime)

Parameters
elapsedTime long

testStarted

public void testStarted (TestDescription test)

Parameters
test TestDescription