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(
|
|
公共方法 | |
|---|---|
void
|
testAssumptionFailure(TestIdentifier testId, String trace)
当原子测试标记其假设的条件为 false 时调用 |
void
|
testEnded(TestIdentifier testId,
报告单个测试用例的执行结束时间。 |
void
|
testFailed(TestIdentifier testId, String trace)
报告单个测试用例的失败。 |
void
|
testIgnored(TestIdentifier testId)
当测试不会运行时(通常是因为测试方法使用 org.junit.Ignore 注释)调用。 |
void
|
testRunEnded(long elapsedTime,
报告测试运行结束。 |
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
常量值: “Runner reported an invalid method '%s' (%s). 出了点问题,跳过其报告。"
公共构造函数
TestRunToTestInvocationForwarder
public TestRunToTestInvocationForwarder (listeners)
| 参数 | |
|---|---|
listeners |
|
公共方法
testAssumptionFailure
public void testAssumptionFailure (TestIdentifier testId, String trace)
当原子测试标记其假设的条件为 false 时调用
| 参数 | |
|---|---|
testId |
TestIdentifier:用于标识测试 |
trace |
String:失败的堆栈轨迹 |
testEnded
public void testEnded (TestIdentifier testId,testMetrics)
报告单个测试用例的执行结束时间。
如果未调用 testFailed(TestIdentifier, String),则此测试通过。还会返回测试用例执行期间可能发出的任何键值指标。
| 参数 | |
|---|---|
testId |
TestIdentifier:用于标识测试 |
testMetrics |
:android.app.Instrumentation#sendStatus 在执行测试用例期间发出的指标的 ERROR(/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,
runMetrics) 报告测试运行结束。
| 参数 | |
|---|---|
elapsedTime |
long:设备报告的已用时间,以毫秒为单位 |
runMetrics |
:android.app.Instrumentation#addResults 在执行测试用例期间发出的指标的 ERROR(/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:用于标识测试 |