BaseRetryDecision

public class BaseRetryDecision
extends Object implements IConfigurationReceiver, IRetryDecision, ITestInformationReceiver

java.lang.Object
   ↳ com.android.tradefed.retry.BaseRetryDecision


IRetryDecision 的基本实现。基本实现方案仅考虑本地信号。

摘要

公共构造函数

BaseRetryDecision()

重试决策的构造函数

公共方法

void addLastAttempt(List<TestRunResult> lastResults)

shouldRetry(IRemoteTest,int,List) 很可能会在最后一次重试尝试之前被调用,因此我们可能会遗漏最后一次尝试的结果,从而影响统计信息。

void addToSkipRetryList(String filterEntry)

添加一个条目以跳过重试。

List<String> getCommandLineArgs()

返回重试决策的命令行实参。

CurrentInvocation.IsolationGrade getIsolationGrade()
int getMaxTestCaseAttempts()

在自动重试期间,每次测试运行的尝试次数上限。

int getMaxTestCaseAttempts(ModuleDefinition module)

在自动重试期间,针对给定模块的每次测试运行的尝试次数上限。

int getMaxTestRunAttempts()

在自动重试期间,每次测试运行的尝试次数上限。

int getMaxTestRunAttempts(ModuleDefinition module)

在自动重试期间,针对给定模块的每次测试运行的尝试次数上限。

RetryStatistics getRetryStatistics()

返回表示重试的 RetryStatistics

RetryStrategy getRetryStrategy()

自动重试期间使用的 RetryStrategy

Set<String> getSkipRetrySet()
TestInformation getTestInformation()
boolean isAutoRetryEnabled()

是否启用自动重试。

boolean rebootAtLastAttempt()

是否在最后一次尝试之前重新启动设备。

void setConfiguration(IConfiguration configuration)

注入正在使用的 IConfiguration

void setInvocationContext(IInvocationContext context)

设置当前调用上下文。

void setTestInformation(TestInformation testInformation)
boolean shouldRetry(IRemoteTest test, ModuleDefinition module, int attemptJustExecuted, List<TestRunResult> previousResults, DeviceNotAvailableException dnae)

决定是否应尝试重试。

boolean shouldRetry(IRemoteTest test, int attemptJustExecuted, List<TestRunResult> previousResults)

决定是否应尝试重试。

RetryPreparationDecision shouldRetryPreparation(ModuleDefinition module, int attempt, int maxAttempt)

决定是否应重试模块准备。

boolean useUpdatedReporting()

如果应使用更新后的报告,则返回 true。

受保护的方法

void isolateRetry(List<ITestDevice> devices)

公共构造函数

BaseRetryDecision

public BaseRetryDecision ()

重试决策的构造函数

公共方法

addLastAttempt

public void addLastAttempt (List<TestRunResult> lastResults)

shouldRetry(IRemoteTest,int,List) 很可能会在最后一次重试尝试之前被调用,因此我们可能会因统计目的而丢失最后一次尝试的结果。此方法可提供这些结果,以便进行适当的统计计算。

addToSkipRetryList

public void addToSkipRetryList (String filterEntry)

添加一个条目以跳过重试。

参数
filterEntry String

getCommandLineArgs

public List<String> getCommandLineArgs ()

返回重试决策的命令行实参。

返回
List<String>

getIsolationGrade

public CurrentInvocation.IsolationGrade getIsolationGrade ()

返回
CurrentInvocation.IsolationGrade

getMaxTestCaseAttempts

public int getMaxTestCaseAttempts ()

在自动重试期间,每次测试运行的尝试次数上限。

返回
int

getMaxTestCaseAttempts

public int getMaxTestCaseAttempts (ModuleDefinition module)

在自动重试期间,针对给定模块的每次测试运行的尝试次数上限。

参数
module ModuleDefinition

返回
int

getMaxTestRunAttempts

public int getMaxTestRunAttempts ()

在自动重试期间,每次测试运行的尝试次数上限。

返回
int

getMaxTestRunAttempts

public int getMaxTestRunAttempts (ModuleDefinition module)

在自动重试期间,针对给定模块的每次测试运行的尝试次数上限。

参数
module ModuleDefinition

返回
int

getRetryStatistics

public RetryStatistics getRetryStatistics ()

返回表示重试的 RetryStatistics

返回
RetryStatistics

getRetryStrategy

public RetryStrategy getRetryStrategy ()

自动重试期间使用的 RetryStrategy

返回
RetryStrategy

getSkipRetrySet

public Set<String> getSkipRetrySet ()

返回
Set<String>

getTestInformation

public TestInformation getTestInformation ()

返回
TestInformation

isAutoRetryEnabled

public boolean isAutoRetryEnabled ()

是否启用自动重试。

返回
boolean

rebootAtLastAttempt

public boolean rebootAtLastAttempt ()

是否在最后一次尝试之前重新启动设备。

返回
boolean

setConfiguration

public void setConfiguration (IConfiguration configuration)

注入正在使用的 IConfiguration

参数
configuration IConfiguration

setInvocationContext

public void setInvocationContext (IInvocationContext context)

设置当前调用上下文。

参数
context IInvocationContext

setTestInformation

public void setTestInformation (TestInformation testInformation)

参数
testInformation TestInformation

shouldRetry

public boolean shouldRetry (IRemoteTest test, 
                ModuleDefinition module, 
                int attemptJustExecuted, 
                List<TestRunResult> previousResults, 
                DeviceNotAvailableException dnae)

决定是否应尝试重试。此外,还需对要重试的 IRemoteTest 进行任何必要的更改(应用过滤条件等)。

参数
test IRemoteTest:刚刚运行的 IRemoteTest

module ModuleDefinition:测试模块的 ModuleDefinition 对象。

attemptJustExecuted int:刚刚运行的尝试的编号。

previousResults List:刚刚运行的测试的 TestRunResult 列表。

dnae DeviceNotAvailableException:设备 DeviceNotAvailableException 不可用异常。

返回
boolean 如果应重试,则为 True;否则为 False。

抛出
DeviceNotAvailableException

shouldRetry

public boolean shouldRetry (IRemoteTest test, 
                int attemptJustExecuted, 
                List<TestRunResult> previousResults)

决定是否应尝试重试。此外,还需对要重试的 IRemoteTest 进行任何必要的更改(应用过滤条件等)。

参数
test IRemoteTest:刚刚运行的 IRemoteTest

attemptJustExecuted int:刚刚运行的尝试的编号。

previousResults List:刚刚运行的测试的 TestRunResult 列表。

返回
boolean 如果应重试,则为 True;否则为 False。

抛出
DeviceNotAvailableException

shouldRetryPreparation

public RetryPreparationDecision shouldRetryPreparation (ModuleDefinition module, 
                int attempt, 
                int maxAttempt)

决定是否应重试模块准备。

参数
module ModuleDefinition

attempt int

maxAttempt int

返回
RetryPreparationDecision

useUpdatedReporting

public boolean useUpdatedReporting ()

如果应使用更新后的报告,则返回 true。

返回
boolean

受保护的方法

isolateRetry

protected void isolateRetry (List<ITestDevice> devices)

参数
devices List

抛出
DeviceNotAvailableException