ConsoleResultReporter

public class ConsoleResultReporter
extends TestResultListener implements ILogSaverListener, ITestInvocationListener

java.lang.Object
com.android.tradefed.result.TestResultListener
  com.android.tradefed.result.ConsoleResultReporter


用于将测试结果输出到控制台的结果报告器。

输出每次测试运行、每个测试用例以及测试指标、测试日志和测试文件位置。

摘要

公共构造函数

ConsoleResultReporter()

公共方法

void invocationEnded(long elapsedTime)

报告调用已终止,无论成功与否,还是由于某些错误 情况。

void invocationStarted(IInvocationContext context)

报告测试调用的开始。

void logAssociation(String dataName, LogFile logFile)

在某些情况下,日志必须与测试用例紧密关联,但无法在直接 testLogSaved(String,LogDataType,InputStreamSource,LogFile) 回调中执行此操作。

void testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)

在保存测试日志时调用。

void testResult(TestDescription test, TestResult result)
void testRunEnded(long elapsedTimeMillis, Map<String, String> metrics)

报告测试运行结束。

void testRunFailed(FailureDescription failure)

报告测试运行因 FailureDescription 中描述的失败而未能完成。

void testRunFailed(String errorMessage)

报告测试运行因严重错误而未能完成。

void testRunStarted(String runName, int testCount)

报告测试运行的开始。

公共构造函数

ConsoleResultReporter

public ConsoleResultReporter ()

公共方法

invocationEnded

public void invocationEnded (long elapsedTime)

报告调用已终止,无论成功与否,还是由于某些错误 情况。

将由 TradeFederation 框架自动调用。

参数
elapsedTime long:调用的经过时间,以毫秒为单位

invocationStarted

public void invocationStarted (IInvocationContext context)

报告测试调用的开始。

将由 TradeFederation 框架自动调用。报告器需要替换 此方法,以支持多个设备报告。

参数
context IInvocationContext:有关调用的信息

logAssociation

public void logAssociation (String dataName, 
                LogFile logFile)

在某些情况下,日志必须与测试用例紧密关联,但无法在直接执行此操作。testLogSaved(String,LogDataType,InputStreamSource,LogFile)因此,此回调允许显式提供紧密关联 。

参数
dataName String:数据的名称

logFile LogFile:之前记录且应与测试用例关联的 测试用例。LogFile

testLogSaved

public void testLogSaved (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream, 
                LogFile logFile)

在保存测试日志时调用。

应替换为 ITestInvocationListener.testLog(String,LogDataType,InputStreamSource)

参数
dataName String:数据的 String 说明性名称。例如“device_logcat”。注意 dataName 在每次调用中可能不是唯一的。也就是说,实现人员必须能够处理 具有相同 dataName 的多次调用

dataType LogDataType:数据的 LogDataType

dataStream InputStreamSource:数据的 InputStreamSource。实现人员应调用 createInputStream 以开始读取数据,并确保在完成后关闭生成的 InputStream。

logFile LogFile:包含已保存文件的元数据的 LogFile

testResult

public void testResult (TestDescription test, 
                TestResult result)

参数
test TestDescription

result TestResult

testRunEnded

public void testRunEnded (long elapsedTimeMillis, 
                Map<String, String> metrics)

报告测试运行结束。

参数
elapsedTimeMillis long:设备报告的经过时间,以毫秒为单位

metrics Map:在测试运行结束时报告的键值对

testRunFailed

public void testRunFailed (FailureDescription failure)

报告测试运行因 FailureDescription 中描述的失败而未能完成。

参数
failure FailureDescription:描述失败及其上下文的 FailureDescription

testRunFailed

public void testRunFailed (String errorMessage)

报告测试运行因严重错误而未能完成。

参数
errorMessage String:描述运行失败原因的 String

testRunStarted

public void testRunStarted (String runName, 
                int testCount)

报告测试运行的开始。

参数
runName String:测试运行名称

testCount int:测试运行中的测试总数