MetricTestCase
public
class
MetricTestCase
extends TestCase
java.lang.Object | |||
↳ | junit.framework.Assert | ||
↳ | junit.framework.TestCase | ||
↳ | com.android.tradefed.testtype.MetricTestCase |
TestCase
的扩展,允许在作为 TradeFed 的一部分运行时记录指标。直接作为 DeviceTestCase
或作为 HostTest
的一部分。TODO:评估是否有必要为 JUnit3 测试提供运行指标(而不仅仅是测试指标)。
摘要
嵌套类 | |
---|---|
class |
MetricTestCase.LogHolder
用于存储要报告的日志文件的结构。 |
字段 | |
---|---|
public
|
mLogs
|
public
|
mMetrics
|
公共构造函数 | |
---|---|
MetricTestCase()
|
|
MetricTestCase(String name)
构造具有给定名称的测试用例。 |
公共方法 | |
---|---|
final
void
|
addTestLog(String dataName, LogDataType dataType, InputStreamSource dataStream)
来自 JUnit3 转发器的回调,用于从测试中获取日志。 |
final
void
|
addTestMetric(String key, MetricMeasurement.Metric metric)
|
final
void
|
addTestMetric(String key, String value)
为测试用例记录指标。 |
字段
mLogs
publicmLogs
mMetrics
publicmMetrics
公共构造函数
MetricTestCase
public MetricTestCase ()
公共方法
addTestLog
public final void addTestLog (String dataName, LogDataType dataType, InputStreamSource dataStream)
来自 JUnit3 转发器的回调,用于从测试中获取日志。
参数 | |
---|---|
dataName |
String :数据的字符串描述性名称,例如“device_logcat”。请注意,dataName 在每次调用时可能并不唯一,即实现者必须能够处理具有相同 dataName 的多次调用 |
dataType |
LogDataType :数据的 LogDataType |
dataStream |
InputStreamSource :数据的 InputStreamSource。实现人员应调用 createInputStream 以开始读取数据,并确保在完成后关闭生成的 InputStream。调用方应确保数据源在 testLog 方法完成之前保持存在且可访问。 |
addTestMetric
public final void addTestMetric (String key, MetricMeasurement.Metric metric)
参数 | |
---|---|
key |
String |
metric |
MetricMeasurement.Metric |
addTestMetric
public final void addTestMetric (String key, String value)
为测试用例记录指标。
参数 | |
---|---|
key |
String :用于查找指标的键。 |
value |
String :与密钥相关联。 |