PrettyTestEventLogger

public class PrettyTestEventLogger
extends Object implements ITestInvocationListener

java.lang.Object
com.android.tradefed.testtype.host.PrettyTestEventLogger


记录与事件匹配的日志,并按顺序记录这些日志,以便更轻松地进行调试。主机端和设备端的日志将严格匹配,以便轻松搜索。

摘要

公共构造函数

PrettyTestEventLogger(List<ITestDevice> devices, boolean methodLevelLogging)

公共方法

void testEnded(TestDescription test, HashMap<String, MetricMeasurement.Metric> testMetrics)

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

void testFailed(TestDescription test, FailureDescription failure)

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

void testFailed(TestDescription test, String trace)

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

void testRunEnded(long elapsedTimeMillis, HashMap<String, MetricMeasurement.Metric> runMetrics)

报告测试运行结束。

void testRunStarted(String runName, int testCount)

报告测试运行开始。

void testStarted(TestDescription test)

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

公共构造函数

PrettyTestEventLogger

public PrettyTestEventLogger (List<ITestDevice> devices, 
                boolean methodLevelLogging)

参数
devices List

methodLevelLogging boolean

公共方法

testEnded

public void testEnded (TestDescription test, 
                HashMap<String, MetricMeasurement.Metric> testMetrics)

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

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

参数
test TestDescription:标识测试

testMetrics HashMap:发出的指标的 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, 
                HashMap<String, MetricMeasurement.Metric> runMetrics)

报告测试运行结束。FIXME:我们不能有两个具有不同类型的 Map<> 接口,因此 我们必须在此处使用 HashMap。

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

runMetrics HashMap:在测试运行结束时报告的键值对,带有 Metric

testRunStarted

public void testRunStarted (String runName, 
                int testCount)

报告测试运行开始。

参数
runName String:测试运行名称

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

testStarted

public void testStarted (TestDescription test)

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

参数
test TestDescription:标识测试