指标测试用例
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) 记录测试用例的指标。 |
字段
日志
publicmLogs
指标
publicmMetrics
公共构造函数
指标测试用例
public MetricTestCase ()
公共方法
添加测试日志
public final void addTestLog (String dataName, LogDataType dataType, InputStreamSource dataStream)
从 JUnit3 转发器回调,以便从测试中获取日志。
参数 | |
---|---|
dataName | String :数据的 String 描述性名称。例如“device_logcat”。注意 dataName 每次调用可能不是唯一的。即实现者必须能够处理具有相同数据名的多个调用 |
dataType | LogDataType :数据的 LogDataType |
dataStream | InputStreamSource :数据的 InputStreamSource。实施者应调用 createInputStream 开始读取数据,并确保在完成后关闭生成的 InputStream。调用者应确保数据源保持存在且可访问,直到 testLog 方法完成。 |
添加测试指标
public final void addTestMetric (String key, MetricMeasurement.Metric metric)
参数 | |
---|---|
key | String |
metric | MetricMeasurement.Metric |
添加测试指标
public final void addTestMetric (String key, String value)
记录测试用例的指标。
参数 | |
---|---|
key | String :将在其下找到指标的键。 |
value | String :与键关联。 |
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-03-30。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"没有我需要的信息"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"太复杂/步骤太多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"内容需要更新"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/代码问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]