ModuleResultsAndMetricsForwarder

public class ModuleResultsAndMetricsForwarder
extends ResultAndLogForwarder

java.lang.Object
   ↳ com.android.tradefed.result.ResultForwarder
     ↳ com.android.tradefed.result.ResultAndLogForwarder
       ↳ com.android.tradefed.result.ModuleResultsAndMetricsForwarder


ResultAndLogForwarder 的扩展,用于向测试结果添加额外的模块相关指标。

摘要

公共构造函数

ModuleResultsAndMetricsForwarder(ITestInvocationListener... listeners)

公共方法

void setAttemptIsolation(CurrentInvocation.IsolationGrade isolation)

设置是否应将尝试报告为孤立的尝试。

void setModuleId(String moduleId)
void setTestMappingSources( testMappingSources)

设置要插入指标中的测试映射来源。

void testEnded(TestDescription test, long endTime, testMetrics)

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

void testEnded(TestDescription test, testMetrics)

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

void testFailed(TestDescription test, FailureDescription failure)

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

void testFailed(TestDescription test, String trace)

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

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 testStarted(TestDescription test, long startTime)

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

void testStarted(TestDescription test)

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

公共构造函数

ModuleResultsAndMetricsForwarder

public ModuleResultsAndMetricsForwarder (ITestInvocationListener... listeners)

参数
listeners ITestInvocationListener

公共方法

setAttemptIsolation

public void setAttemptIsolation (CurrentInvocation.IsolationGrade isolation)

设置是否应将尝试报告为孤立的尝试。

参数
isolation CurrentInvocation.IsolationGrade

setModuleId

public void setModuleId (String moduleId)

参数
moduleId String

setTestMappingSources

public void setTestMappingSources ( testMappingSources)

设置要插入指标中的测试映射来源。

参数
testMappingSources

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, 
                 testMetrics)

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

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

参数
test TestDescription:用于标识测试

testMetrics :发出的指标的 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:失败的堆栈轨迹

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 StringString,用于说明运行失败的原因。

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

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:用于标识测试