ResultReporter

public class ResultReporter
extends Object implements IConfigurationReceiver, ILogSaverListener, ISupportGranularResults, ITestSummaryListener

java.lang.Object
   ↳ com.google.android.tradefed.result.teststorage.ResultReporter


摘要

嵌套的类

class ResultReporter.ListBuilder<T>

 

常量

String DEFAULT_BUILDPROVIDER

String EXPERIMENTAL

String SYSTEM_CHECKER

String TRADEFED

公共构造函数

ResultReporter()

公共方法

void enableFilterProperty(boolean enableFilterProperty)
IConfiguration getConfiguration()
TestSummary getSummary()

允许 InvocationListener 返回摘要。

void invocationEnded(long elapsedTime)

报告调用已终止,无论是成功终止还是因某些错误情况而终止。

void invocationFailed(FailureDescription failure)

报告由于某种错误情况而导致的不完整调用。

void invocationFailed(Throwable cause)

报告由于某种错误情况而导致的不完整调用。

void invocationSkipped(SkipReason reason)

报告调用已跳过

void invocationStarted(IInvocationContext context)

报告测试调用的开始。

void logAssociation(String dataName, LogFile log)

在某些情况下,日志必须与测试用例紧密关联,但无法在直接 testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile) 回调中实现此目的。

void putEarlySummary( summaries)

传递一个非 null TestSummaryERROR(/List),该 ERROR(/List) 可能来自作为配置一部分实例化的任何 ITestInvocationListener

void setConfiguration(IConfiguration configuration)

注入正在使用的 IConfiguration

void setLogSaver(ILogSaver logSaver)

ILogSaver 设置为允许实现者保存文件。

boolean supportGranularResults()

如果报告器支持精细结果,则返回 True,否则返回 False。

void testAssumptionFailure(TestDescription test, String trace)

当原子测试标记其假设的条件为 false 时调用

void testAssumptionFailure(TestDescription test, FailureDescription failure)

当原子测试标记其假设的条件为 false 时调用

void testEnded(TestDescription test, long endTime, testMetrics)

ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map)) 的替代方案,可直接指定结束时间。

void testEnded(TestDescription test, metrics)

报告单个测试用例的执行结束时间。

void testFailed(TestDescription test, FailureDescription failure)

报告单个测试用例的失败。

void testFailed(TestDescription test, String trace)

报告单个测试用例的失败。

void testIgnored(TestDescription test)

当测试不会运行时(通常是因为测试方法使用 org.junit.Ignore 注释)调用。

void testModuleEnded()

报告模块运行结束。

void testModuleStarted(IInvocationContext moduleContext)

报告模块运行的开始时间。

void testRunEnded(long elapsedTimeMillis, runMetrics)

报告测试运行结束。

void testRunFailed(FailureDescription failure)

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

void testRunFailed(String errorMessage)

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

void testRunStarted(String runName, int testCount, int attemptNumber)

报告测试运行的开始。

void testRunStarted(String runName, int testCount)

报告测试运行的开始。

void testRunStarted(String runName, int testCount, int attemptNumber, long startTime)

报告测试运行的开始。

void testSkipped(TestDescription test, SkipReason reason)

当测试因通常不预期的原因而被跳过且未执行时调用。

void testStarted(TestDescription test, long startTime)

testStarted(com.android.tradefed.result.TestDescription) 的替代方案,其中还指定了测试开始时间,并与 ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map)) 结合使用以实现精确衡量。

void testStarted(TestDescription test)

报告单个测试用例的开始。

受保护的方法

ITestStorageClient createTestStorageClient(IInvocationContext context)
String getVersion()

常量

DEFAULT_BUILDPROVIDER

public static final String DEFAULT_BUILDPROVIDER

常量值: "androidbuild"

实验性

public static final String EXPERIMENTAL

常量值: "experimental"

SYSTEM_CHECKER

public static final String SYSTEM_CHECKER

常量值: "system_checker"

TRADEFED

public static final String TRADEFED

常量值: "tradefed"

公共构造函数

ResultReporter

public ResultReporter ()

公共方法

enableFilterProperty

public void enableFilterProperty (boolean enableFilterProperty)

参数
enableFilterProperty boolean

getConfiguration

public IConfiguration getConfiguration ()

返回
IConfiguration

getSummary

public TestSummary getSummary ()

允许 InvocationListener 返回摘要。

返回
TestSummary 总结跑步活动的 TestSummary,或 null

invocationEnded

public void invocationEnded (long elapsedTime)

报告调用已终止,无论是成功终止还是因某些错误情况而终止。

将由 TradeFederation 框架自动调用。

参数
elapsedTime long:调用的已用时间(以毫秒为单位)

invocationFailed

public void invocationFailed (FailureDescription failure)

报告由于某种错误情况而导致的不完整调用。

将由 TradeFederation 框架自动调用。

参数
failure FailureDescription:描述失败原因的 FailureDescription

invocationFailed

public void invocationFailed (Throwable cause)

报告由于某种错误情况而导致的不完整调用。

将由 TradeFederation 框架自动调用。

参数
cause Throwable:失败的 Throwable 原因

invocationSkipped

public void invocationSkipped (SkipReason reason)

报告调用已跳过

参数
reason SkipReason

invocationStarted

public void invocationStarted (IInvocationContext context)

报告测试调用的开始。

将由 TradeFederation 框架自动调用。报告者需要替换此方法才能支持多设备报告。

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

logAssociation

public void logAssociation (String dataName, 
                LogFile log)

在某些情况下,日志必须与测试用例紧密关联,但无法在直接 testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile) 回调中实现这一点。因此,此回调允许明确提供强关联。

参数
dataName String:数据的名称

log LogFile:之前记录的 LogFile,应与测试用例相关联。

putEarlySummary

public void putEarlySummary ( summaries)

传递一个非 null TestSummaryERROR(/List),该 ERROR(/List) 可能已从作为配置一部分实例化的任何 ITestInvocationListener 返回。早期摘要在 ITestInvocationListener.invocationStarted(com.android.tradefed.invoker.IInvocationContext) 之后生成,可通过 ERROR(/#putSummary(List)) 在调用结束时完成。

此方法在 ITestInvocationListener.invocationStarted(com.android.tradefed.invoker.IInvocationContext) 之前调用,包含之前配置的监听器中的所有摘要。

参数
summaries :当前配置中 ITestInvocationListener 的非 null TestSummaryERROR(/List)

setConfiguration

public void setConfiguration (IConfiguration configuration)

注入正在使用的 IConfiguration

参数
configuration IConfiguration

setLogSaver

public void setLogSaver (ILogSaver logSaver)

ILogSaver 设置为允许实现者保存文件。

参数
logSaver ILogSaverILogSaver

supportGranularResults

public boolean supportGranularResults ()

如果报告器支持精细结果,则返回 True,否则返回 False。

返回
boolean

testAssumptionFailure

public void testAssumptionFailure (TestDescription test, 
                String trace)

当原子测试标记其假设的条件为 false 时调用

参数
test TestDescription:用于标识测试

trace String:失败的堆栈轨迹

testAssumptionFailure

public void testAssumptionFailure (TestDescription test, 
                FailureDescription failure)

当原子测试标记其假设的条件为 false 时调用

参数
test TestDescription:用于标识测试

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

testEnded

public void testEnded (TestDescription test, 
                long endTime, 
                 testMetrics)

ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map)) 的替代方案,可直接指定结束时间。与 testStarted(com.android.tradefed.result.TestDescription, long) 结合使用,可实现精确测量。

参数
test TestDescription:用于标识测试

endTime long:测试结束时间,通过 System.currentTimeMillis() 测量

testMetrics :所发出指标的 ERROR(/Map)

testEnded

public void testEnded (TestDescription test, 
                 metrics)

报告单个测试用例的执行结束时间。

如果未调用 testFailed(TestDescription, FailureDescription),则此测试通过。还会返回测试用例执行期间可能发出的任何键值指标。

参数
test TestDescription:用于标识测试

metrics :所发出指标的 ERROR(/Map)

testFailed

public void testFailed (TestDescription test, 
                FailureDescription failure)

报告单个测试用例的失败。

将在 testStarted 和 testEnded 之间调用。

参数
test TestDescription:用于标识测试

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

testFailed

public void testFailed (TestDescription test, 
                String trace)

报告单个测试用例的失败。

将在 testStarted 和 testEnded 之间调用。

参数
test TestDescription:用于标识测试

trace String:失败的堆栈轨迹

testIgnored

public void testIgnored (TestDescription test)

当测试不会运行时(通常是因为测试方法使用 org.junit.Ignore 注释)调用。

参数
test TestDescription:用于标识测试

testModuleEnded

public void testModuleEnded ()

报告模块运行结束。

testModuleStarted

public void testModuleStarted (IInvocationContext moduleContext)

报告模块运行的开始时间。此回调与 testModuleEnded() 相关联,在序列中是可选的。仅在运行使用模块(基于套件的运行程序)时使用。

参数
moduleContext IInvocationContext:模块的 IInvocationContext

testRunEnded

public void testRunEnded (long elapsedTimeMillis, 
                 runMetrics)

报告测试运行结束。

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

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

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, 
                int attemptNumber)

报告测试运行的开始。

参数
runName String:测试运行名称

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

attemptNumber int:用于标识多次运行的同一 runName 的不同尝试的订单号。attemptNumber 从 0 开始,每次新运行时都会递增。例如,如果某项测试进行了 3 次精细重试,则在同一 runName 下,该测试总共应运行 4 次,且 attemptNumber 从 0 到 3。

testRunStarted

public void testRunStarted (String runName, 
                int testCount)

报告测试运行的开始。

参数
runName String:测试运行名称

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

testRunStarted

public void testRunStarted (String runName, 
                int testCount, 
                int attemptNumber, 
                long startTime)

报告测试运行的开始。

参数
runName String:测试运行名称

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

attemptNumber int:用于标识多次运行的同一 runName 的不同尝试的订单号。attemptNumber 从 0 开始,每次新运行都会递增。例如,如果某项测试进行了 3 次精细重试,则在同一 runName 下,该测试总共应运行 4 次,且 attemptNumber 从 0 到 3。

startTime long:运行开始时间,通过 System.currentTimeMillis() 测量

testSkipped

public void testSkipped (TestDescription test, 
                SkipReason reason)

当测试因通常不预期的原因而被跳过且未执行时调用。系统将尝试重试这些测试,以尝试获得正确的执行结果。

参数
test TestDescription:用于标识测试

reason SkipReasonSkipReason

testStarted

public void testStarted (TestDescription test, 
                long startTime)

testStarted(com.android.tradefed.result.TestDescription) 的替代方案,其中还指定了测试的开始时间,并与 ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map)) 结合使用以实现精确衡量。

参数
test TestDescription:用于标识测试

startTime long:测试开始时间,通过 System.currentTimeMillis() 测量

testStarted

public void testStarted (TestDescription test)

报告单个测试用例的开始。旧版接口,应尽可能使用 testStarted(com.android.tradefed.result.TestDescription)

参数
test TestDescription:用于标识测试

受保护的方法

createTestStorageClient

protected ITestStorageClient createTestStorageClient (IInvocationContext context)

参数
context IInvocationContext

返回
ITestStorageClient

getVersion

protected String getVersion ()

返回
String