TestRunToTestInvocationForwarder
public
class
TestRunToTestInvocationForwarder
extends Object
implements
ITestRunListener
| java.lang.Object | |
| ↳ | com.android.tradefed.result.ddmlib.TestRunToTestInvocationForwarder |
从 ddmlib ITestRunListener 到 ITestLifeCycleReceiver 的转发器。用于确保将结果从 ddmlib 接口转换为 Tradefed 接口的接口。
Ddmlib 接口已关联到正在运行的插桩测试。
摘要
常量 | |
|---|---|
String |
ERROR_MESSAGE_FORMAT
|
公共构造函数 | |
|---|---|
TestRunToTestInvocationForwarder(ITestLifeCycleReceiver listener)
|
|
TestRunToTestInvocationForwarder(Collection<ITestLifeCycleReceiver> listeners)
|
|
公共方法 | |
|---|---|
void
|
testAssumptionFailure(TestIdentifier testId, String trace)
当原子测试标记其假设的条件为 false 时调用 |
void
|
testEnded(TestIdentifier testId, Map<String, String> testMetrics)
报告单个测试用例的执行结束时间。 |
void
|
testFailed(TestIdentifier testId, String trace)
报告单个测试用例的失败情况。 |
void
|
testIgnored(TestIdentifier testId)
当测试不会运行时(通常是因为测试方法使用 org.junit.Ignore 注释进行了注释)调用。 |
void
|
testRunEnded(long elapsedTime, Map<String, String> runMetrics)
报告测试运行结束。 |
void
|
testRunFailed(String failure)
由于出现严重错误,报告测试运行未能完成。 |
void
|
testRunStarted(String runName, int testCount)
报告测试运行的开始。 |
void
|
testRunStopped(long elapsedTime)
报告测试运行因用户请求而在完成前停止。 |
void
|
testStarted(TestIdentifier testId)
报告单个测试用例的开始。 |
常量
ERROR_MESSAGE_FORMAT
public static final String ERROR_MESSAGE_FORMAT
常量值: “运行程序报告了无效方法‘%s’(%s)。出了点问题,跳过其报告。”
公共构造函数
TestRunToTestInvocationForwarder
public TestRunToTestInvocationForwarder (ITestLifeCycleReceiver listener)
| 参数 | |
|---|---|
listener |
ITestLifeCycleReceiver |
TestRunToTestInvocationForwarder
public TestRunToTestInvocationForwarder (Collection<ITestLifeCycleReceiver> listeners)
| 参数 | |
|---|---|
listeners |
Collection |
公共方法
testAssumptionFailure
public void testAssumptionFailure (TestIdentifier testId, String trace)
当原子测试标记其假设的条件为 false 时调用
| 参数 | |
|---|---|
testId |
TestIdentifier:标识测试 |
trace |
String:失败的堆栈轨迹 |
testEnded
public void testEnded (TestIdentifier testId, Map<String, String> testMetrics)
报告单个测试用例的执行结束时间。
如果未调用 testFailed(TestIdentifier, String),则此测试通过。还会返回测试用例执行期间可能发出的任何键值指标。
| 参数 | |
|---|---|
testId |
TestIdentifier:标识测试 |
testMetrics |
Map:android.app.Instrumentation#sendStatus 在执行测试用例期间发出的指标的 Map。除非您多次发出相同的键,否则系统会保留插入顺序。请注意,IInstrumentationResultParser.StatusKeys 中定义的标准键会从此映射中过滤掉。Ddmlib 可能会添加 IInstrumentationResultParser.StatusKeys 中定义的额外测试指标。 |
testFailed
public void testFailed (TestIdentifier testId, String trace)
报告单个测试用例的失败。
将在 testStarted 和 testEnded 之间调用。
| 参数 | |
|---|---|
testId |
TestIdentifier:标识测试 |
trace |
String:失败的堆栈轨迹 |
testIgnored
public void testIgnored (TestIdentifier testId)
当测试不会运行时调用,通常是因为测试方法使用 org.junit.Ignore 注释。
| 参数 | |
|---|---|
testId |
TestIdentifier:标识测试 |
testRunEnded
public void testRunEnded (long elapsedTime,
Map<String, String> runMetrics)报告测试运行结束。
| 参数 | |
|---|---|
elapsedTime |
long:设备报告的已用时间,以毫秒为单位 |
runMetrics |
Map:android.app.Instrumentation#addResults 在执行测试用例期间发出的指标的 Map。除非您多次发出相同的键,否则系统会保留插入顺序。请注意,IInstrumentationResultParser.StatusKeys 中定义的标准键会从此映射中过滤掉。Ddmlib 可能会添加 IInstrumentationResultParser.StatusKeys 中定义的额外测试指标。 |
testRunFailed
public void testRunFailed (String failure)
由于出现严重错误,报告测试运行未能完成。
| 参数 | |
|---|---|
failure |
String:String,用于描述运行失败的原因。 |
testRunStarted
public void testRunStarted (String runName,
int testCount)报告测试运行的开始。
| 参数 | |
|---|---|
runName |
String:测试运行名称 |
testCount |
int:测试运行中的测试总数 |
testRunStopped
public void testRunStopped (long elapsedTime)
报告测试运行因用户请求而在完成前停止。
| 参数 | |
|---|---|
elapsedTime |
long:设备报告的已用时间,以毫秒为单位 |
testStarted
public void testStarted (TestIdentifier testId)
报告单个测试用例的开始。
| 参数 | |
|---|---|
testId |
TestIdentifier:标识测试 |