LogFilesReporter

public class LogFilesReporter
extends Object implements IRemoteTest, IDeviceTest

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


Helper test component that pulls files located on a device and adds them to the test logs. The component provides IRemoteTest and IDeviceTest services.

The path to files on the device is specified with upload-dir or upload-pattern options. The files will be removed if clean-upload-pattern option is provided.

Summary

Public constructors

LogFilesReporter()

Public methods

ITestDevice getDevice()

Get the device under test.

void run(ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

void setDevice(ITestDevice device)

Inject the device under test.

Protected methods

void cleanFilesOnDevice(String pattern)

Cleans the files on the device.

boolean doesDirectoryExistOnDevice(String folder)

Checks to see if a directory exists on a device.

void uploadFilesOnDeviceToLogs(String filesPattern, ITestInvocationListener listener)

Uploads files from a device to test logs.

void uploadFolderOnDeviceToLogs(String dir, ITestInvocationListener listener)

Uploads files from a device to test logs.

Public constructors

LogFilesReporter

LogFilesReporter ()

Public methods

getDevice

ITestDevice getDevice ()

Get the device under test.

Returns
ITestDevice the ITestDevice

run

void run (ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

Parameters
listener ITestInvocationListener: the ITestInvocationListener of test results
Throws
DeviceNotAvailableException

setDevice

void setDevice (ITestDevice device)

Inject the device under test.

Parameters
device ITestDevice: the ITestDevice to use

Protected methods

cleanFilesOnDevice

void cleanFilesOnDevice (String pattern)

Cleans the files on the device.

Parameters
pattern String: a path pattern to files to be removed.
Throws
DeviceNotAvailableException in case device is unavailable.

doesDirectoryExistOnDevice

boolean doesDirectoryExistOnDevice (String folder)

Checks to see if a directory exists on a device.

Parameters
folder String: a full path to a directory on a device to be verified.
Returns
boolean true if a directory exists, false otherwise.
Throws
DeviceNotAvailableException in case device is unavailable.

uploadFilesOnDeviceToLogs

void uploadFilesOnDeviceToLogs (String filesPattern, 
                ITestInvocationListener listener)

Uploads files from a device to test logs.

Parameters
filesPattern String: a path pattern to files on device to be added to the logs.
listener ITestInvocationListener: a listener for test results from the test invocation.
Throws
DeviceNotAvailableException in case device is unavailable.

uploadFolderOnDeviceToLogs

void uploadFolderOnDeviceToLogs (String dir, 
                ITestInvocationListener listener)

Uploads files from a device to test logs.

Parameters
dir String: a full path to a folder on device containing files to be added to the logs.
listener ITestInvocationListener: a listener for test results from the test invocation.
Throws
DeviceNotAvailableException in case device is unavailable.