基本重试决策
public class BaseRetryDecision
extends Object
implements IRetryDecision , IConfigurationReceiver
java.lang.Object | |
↳ | com.android.tradefed.retry.BaseRetryDecision |
IRetryDecision
的基本实现。基本实现仅考虑本地信号。
概括
公共构造函数 | |
---|---|
BaseRetryDecision () 重试决策的构造函数 |
公共方法 | |
---|---|
void | addLastAttempt ( lastResults) addLastAttempt ( lastResults) |
static | getFailedTestCases ( previousResults) getFailedTestCases ( previousResults) 返回应重试的失败测试用例的映射。 |
CurrentInvocation.IsolationGrade | getIsolationGrade () |
int | getMaxRetryCount () 自动重试期间的最大尝试次数。 |
RetryStatistics | getRetryStatistics () 返回表示重试的 |
RetryStrategy | getRetryStrategy () 自动重试期间使用的 |
boolean | isAutoRetryEnabled () 是否启用自动重试。 |
boolean | rebootAtLastAttempt () 是否在最后一次尝试之前重新启动设备。 |
void | setConfiguration ( IConfiguration configuration) 注入正在使用的 |
void | setInvocationContext (IInvocationContext context) 设置当前调用上下文。 |
boolean | shouldRetry (IRemoteTest test, int attemptJustExecuted, previousResults) shouldRetry (IRemoteTest test, int attemptJustExecuted, previousResults) 决定是否应尝试重试。 |
boolean | shouldRetry (IRemoteTest test, ModuleDefinition module, int attemptJustExecuted, previousResults) shouldRetry (IRemoteTest test, ModuleDefinition module, int attemptJustExecuted, previousResults) 决定是否应尝试重试。 |
boolean | useUpdatedReporting () 如果我们应该使用更新的报告,则返回 true。 |
受保护的方法 | |
---|---|
void | isolateRetry ( devices) isolateRetry ( devices) |
公共构造函数
基本重试决策
public BaseRetryDecision ()
重试决策的构造函数
公共方法
添加最后一次尝试
public void addLastAttempt (lastResults)
ERROR(/#shouldRetry(com.android.tradefed.testtype.IRemoteTest,int,List))
很可能会在最后一次重试尝试之前被调用,因此出于统计目的,我们可能会丢失最后一次尝试的结果。该方法允许提供这些结果以进行正确的统计计算。
获取失败的测试用例
public staticgetFailedTestCases ( previousResults)
返回应重试的失败测试用例的映射。
参数 | |
---|---|
previousResults |
退货 | |
---|---|
获取隔离等级
public CurrentInvocation.IsolationGrade getIsolationGrade ()
退货 | |
---|---|
CurrentInvocation.IsolationGrade |
获取最大重试次数
public int getMaxRetryCount ()
自动重试期间的最大尝试次数。
退货 | |
---|---|
int |
是否启用自动重试
public boolean isAutoRetryEnabled ()
是否启用自动重试。
退货 | |
---|---|
boolean |
最后一次尝试重新启动
public boolean rebootAtLastAttempt ()
是否在最后一次尝试之前重新启动设备。
退货 | |
---|---|
boolean |
设置配置
public void setConfiguration (IConfiguration configuration)
注入正在使用的IConfiguration
。
参数 | |
---|---|
configuration | IConfiguration |
设置调用上下文
public void setInvocationContext (IInvocationContext context)
设置当前调用上下文。
参数 | |
---|---|
context | IInvocationContext |
应该重试
public boolean shouldRetry (IRemoteTest test, int attemptJustExecuted,previousResults)
决定是否应尝试重试。还要对要重试的IRemoteTest
进行任何必要的更改(应用过滤器等)。
参数 | |
---|---|
test | IRemoteTest :刚刚运行的IRemoteTest 。 |
attemptJustExecuted | int :我们刚刚运行的尝试的编号。 |
previousResults | TestRunResult 列表。 |
退货 | |
---|---|
boolean | 如果我们应该重试,则为 True,否则为 False。 |
投掷 | |
---|---|
DeviceNotAvailableException |
应该重试
public boolean shouldRetry (IRemoteTest test, ModuleDefinition module, int attemptJustExecuted,previousResults)
决定是否应尝试重试。还要对要重试的IRemoteTest
进行任何必要的更改(应用过滤器等)。
参数 | |
---|---|
test | IRemoteTest :刚刚运行的IRemoteTest 。 |
module | ModuleDefinition :测试模块的ModuleDefinition 对象。 |
attemptJustExecuted | int :我们刚刚运行的尝试的编号。 |
previousResults | TestRunResult 列表。 |
退货 | |
---|---|
boolean | 如果我们应该重试,则为 True,否则为 False。 |
投掷 | |
---|---|
DeviceNotAvailableException |
使用更新报告
public boolean useUpdatedReporting ()
如果我们应该使用更新的报告,则返回 true。
退货 | |
---|---|
boolean |
受保护的方法
隔离重试
protected void isolateRetry (devices)
参数 | |
---|---|
devices |
投掷 | |
---|---|
DeviceNotAvailableException |