AndroidJUnit测试

public class AndroidJUnitTest
extends InstrumentationTest implements IRuntimeHintProvider , ITestFileFilterReceiver , ITestFilterReceiver , ITestAnnotationFilterReceiver , IShardableTest

java.lang.Object
com.android.tradefed.testtype.InstrumentationTest
com.android.tradefed.testtype.AndroidJUnitTest


使用 android.support.test.runner.AndroidJUnitRunner 在给定设备上运行仪器测试包的测试。

概括

领域

public static final String EXCLUDE_COLLECTOR_FILTER_KEY

public static final String INCLUDE_COLLECTOR_FILTER_KEY

收集器端帮助程序库中的选项。

public static final String NEW_RUN_LISTENER_ORDER_KEY

仪器测试运行程序参数用于在设备端启用新的RunListener顺序。

public static final String USE_TEST_STORAGE_SERVICE

公共构造函数

AndroidJUnitTest ()

公共方法

void addAllExcludeAnnotation ( excludeAnnotations) addAllExcludeAnnotation ( excludeAnnotations)

添加ERROR(/Set)注释以排除测试是否用它标记。

void addAllExcludeFilters ( filters) addAllExcludeFilters ( filters)

添加要排除的测试的过滤器的ERROR(/Set)

void addAllIncludeAnnotation ( annotations) addAllIncludeAnnotation ( annotations)

添加ERROR(/Set)注释以包含测试是否用它标记。

void addAllIncludeFilters ( filters) addAllIncludeFilters ( filters)

添加要包含的测试的过滤器的ERROR(/Set)

void addExcludeAnnotation (String excludeAnnotation)

添加注释以排除测试是否用它标记。

void addExcludeFilter (String filter)

添加要排除的测试的过滤器。

void addIncludeAnnotation (String annotation)

添加注释以包含测试是否用它标记。

void addIncludeFilter (String filter)

添加要包含的测试的过滤器。

void clearExcludeAnnotations ()

删除当前跟踪的所有排除注释。

void clearExcludeFilters ()

删除当前跟踪的所有排除过滤器。

void clearIncludeAnnotations ()

删除当前跟踪的所有包含注释。

void clearIncludeFilters ()

删除当前跟踪的所有包含过滤器。

getExcludeAnnotations ()

返回要排除的注释的当前ERROR(/Set)

getExcludeFilters ()

返回排除过滤器的当前ERROR(/Set)

File getExcludeTestFile ()

返回包含排除的测试的文件。

getIncludeAnnotations ()

返回要包含的注释的当前ERROR(/Set)

getIncludeFilters ()

返回包含过滤器的当前ERROR(/Set)

File getIncludeTestFile ()

返回包含所包含测试的文件。

long getRuntimeHint ()

返回测试的预期运行时间(以毫秒为单位)。

boolean isClassOrMethod (String filter)

如果字符串是类或方法的名称,则返回。

boolean isParameterizedTest (String filter)

返回字符串是否是参数化测试。

boolean isRegex (String filter)

返回字符串是否是过滤器的正则表达式。

void run ( TestInformation testInfo, ITestInvocationListener listener)

运行测试,并将结果报告给侦听器。

void setExcludeTestFile (File testFile)

设置排除的测试文件。

void setIncludeTestFile (File testFile)

设置包含的测试文件。

split (int shardCount)

split()的替代版本还提供尝试运行的 shardCount。

受保护的方法

void setRunnerArgs (IRemoteAndroidTestRunner runner)

领域

EXCLUDE_COLLECTOR_FILTER_KEY

public static final String EXCLUDE_COLLECTOR_FILTER_KEY

INCLUDE_COLLECTOR_FILTER_KEY

public static final String INCLUDE_COLLECTOR_FILTER_KEY

收集器端帮助程序库中的选项。

NEW_RUN_LISTENER_ORDER_KEY

public static final String NEW_RUN_LISTENER_ORDER_KEY

仪器测试运行程序参数用于在设备端启用新的RunListener顺序。

使用_测试_存储_服务

public static final String USE_TEST_STORAGE_SERVICE

公共构造函数

AndroidJUnit测试

public AndroidJUnitTest ()

公共方法

添加全部排除注释

public void addAllExcludeAnnotation ( excludeAnnotations)

添加ERROR(/Set)注释以排除测试是否用它标记。

参数
excludeAnnotations

添加所有排除过滤器

public void addAllExcludeFilters ( filters)

添加要排除的测试的过滤器的ERROR(/Set)

参数
filters

添加全部包含注释

public void addAllIncludeAnnotation ( annotations)

添加ERROR(/Set)注释以包含测试是否用它标记。

参数
annotations

添加所有包含过滤器

public void addAllIncludeFilters ( filters)

添加要包含的测试的过滤器的ERROR(/Set)

参数
filters

添加排除注释

public void addExcludeAnnotation (String excludeAnnotation)

添加注释以排除测试是否用它标记。

参数
excludeAnnotation String

添加排除过滤器

public void addExcludeFilter (String filter)

添加要排除的测试的过滤器。

参数
filter String

添加包含注释

public void addIncludeAnnotation (String annotation)

添加注释以包含测试是否用它标记。

参数
annotation String

添加包含过滤器

public void addIncludeFilter (String filter)

添加要包含的测试的过滤器。

参数
filter String

清除排除注释

public void clearExcludeAnnotations ()

删除当前跟踪的所有排除注释。

清除排除过滤器

public void clearExcludeFilters ()

删除当前跟踪的所有排除过滤器。

清除包含注释

public void clearIncludeAnnotations ()

删除当前跟踪的所有包含注释。

清除包含过滤器

public void clearIncludeFilters ()

删除当前跟踪的所有包含过滤器。

获取排除注释

public  getExcludeAnnotations ()

返回要排除的注释的当前ERROR(/Set)

退货

获取排除过滤器

public  getExcludeFilters ()

返回排除过滤器的当前ERROR(/Set)

退货

获取排除测试文件

public File getExcludeTestFile ()

返回包含排除的测试的文件。

退货
File

获取包含注释

public  getIncludeAnnotations ()

返回要包含的注释的当前ERROR(/Set)

退货

获取包含过滤器

public  getIncludeFilters ()

返回包含过滤器的当前ERROR(/Set)

退货

获取包含测试文件

public File getIncludeTestFile ()

返回包含所包含测试的文件。

退货
File

获取运行时提示

public long getRuntimeHint ()

返回测试的预期运行时间(以毫秒为单位)。该时间用于负载平衡分片执行

退货
long

是类或方法

public boolean isClassOrMethod (String filter)

如果字符串是类或方法的名称,则返回。

参数
filter String

退货
boolean

is参数化测试

public boolean isParameterizedTest (String filter)

返回字符串是否是参数化测试。

参数
filter String

退货
boolean

是正则表达式

public boolean isRegex (String filter)

返回字符串是否是过滤器的正则表达式。

参数
filter String

退货
boolean

跑步

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

运行测试,并将结果报告给侦听器。

参数
testInfo TestInformationTestInformation对象包含运行测试的有用信息。

listener ITestInvocationListener :测试结果的ITestInvocationListener

投掷
DeviceNotAvailableException

设置排除测试文件

public void setExcludeTestFile (File testFile)

设置排除的测试文件。不确保 testFile 存在或者是一个文件。

参数
testFile File

设置包含测试文件

public void setIncludeTestFile (File testFile)

设置包含的测试文件。不确保 testFile 存在或者是一个文件。

参数
testFile File

分裂

public  split (int shardCount)

split()的替代版本还提供尝试运行的 shardCount。这对于某些有时无法随意决定的测试运行者很有用。

参数
shardCount int :尝试的分片计数。

退货
要单独执行的子测试的集合,如果测试当前不可分片,则为null

受保护的方法

设置RunnerArgs

protected void setRunnerArgs (IRemoteAndroidTestRunner runner)

参数
runner IRemoteAndroidTestRunner

,

AndroidJUnit测试

public class AndroidJUnitTest
extends InstrumentationTest implements IRuntimeHintProvider , ITestFileFilterReceiver , ITestFilterReceiver , ITestAnnotationFilterReceiver , IShardableTest

java.lang.Object
com.android.tradefed.testtype.InstrumentationTest
com.android.tradefed.testtype.AndroidJUnitTest


使用 android.support.test.runner.AndroidJUnitRunner 在给定设备上运行仪器测试包的测试。

概括

领域

public static final String EXCLUDE_COLLECTOR_FILTER_KEY

public static final String INCLUDE_COLLECTOR_FILTER_KEY

收集器端帮助程序库中的选项。

public static final String NEW_RUN_LISTENER_ORDER_KEY

仪器测试运行程序参数用于在设备端启用新的RunListener顺序。

public static final String USE_TEST_STORAGE_SERVICE

公共构造函数

AndroidJUnitTest ()

公共方法

void addAllExcludeAnnotation ( excludeAnnotations) addAllExcludeAnnotation ( excludeAnnotations)

添加ERROR(/Set)注释以排除测试是否用它标记。

void addAllExcludeFilters ( filters) addAllExcludeFilters ( filters)

添加要排除的测试的过滤器的ERROR(/Set)

void addAllIncludeAnnotation ( annotations) addAllIncludeAnnotation ( annotations)

添加ERROR(/Set)注释以包含测试是否用它标记。

void addAllIncludeFilters ( filters) addAllIncludeFilters ( filters)

添加要包含的测试的过滤器的ERROR(/Set)

void addExcludeAnnotation (String excludeAnnotation)

添加注释以排除测试是否用它标记。

void addExcludeFilter (String filter)

添加要排除的测试的过滤器。

void addIncludeAnnotation (String annotation)

添加注释以包含测试是否用它标记。

void addIncludeFilter (String filter)

添加要包含的测试的过滤器。

void clearExcludeAnnotations ()

删除当前跟踪的所有排除注释。

void clearExcludeFilters ()

删除当前跟踪的所有排除过滤器。

void clearIncludeAnnotations ()

删除当前跟踪的所有包含注释。

void clearIncludeFilters ()

删除当前跟踪的所有包含过滤器。

getExcludeAnnotations ()

返回要排除的注释的当前ERROR(/Set)

getExcludeFilters ()

返回排除过滤器的当前ERROR(/Set)

File getExcludeTestFile ()

返回包含排除的测试的文件。

getIncludeAnnotations ()

返回要包含的注释的当前ERROR(/Set)

getIncludeFilters ()

返回包含过滤器的当前ERROR(/Set)

File getIncludeTestFile ()

返回包含所包含测试的文件。

long getRuntimeHint ()

返回测试的预期运行时间(以毫秒为单位)。

boolean isClassOrMethod (String filter)

如果字符串是类或方法的名称,则返回。

boolean isParameterizedTest (String filter)

返回字符串是否是参数化测试。

boolean isRegex (String filter)

返回字符串是否是过滤器的正则表达式。

void run ( TestInformation testInfo, ITestInvocationListener listener)

运行测试,并将结果报告给侦听器。

void setExcludeTestFile (File testFile)

设置排除的测试文件。

void setIncludeTestFile (File testFile)

设置包含的测试文件。

split (int shardCount)

split()的替代版本还提供尝试运行的 shardCount。

受保护的方法

void setRunnerArgs (IRemoteAndroidTestRunner runner)

领域

EXCLUDE_COLLECTOR_FILTER_KEY

public static final String EXCLUDE_COLLECTOR_FILTER_KEY

INCLUDE_COLLECTOR_FILTER_KEY

public static final String INCLUDE_COLLECTOR_FILTER_KEY

收集器端帮助程序库中的选项。

NEW_RUN_LISTENER_ORDER_KEY

public static final String NEW_RUN_LISTENER_ORDER_KEY

仪器测试运行程序参数用于在设备端启用新的RunListener顺序。

使用_测试_存储_服务

public static final String USE_TEST_STORAGE_SERVICE

公共构造函数

AndroidJUnit测试

public AndroidJUnitTest ()

公共方法

添加全部排除注释

public void addAllExcludeAnnotation ( excludeAnnotations)

添加ERROR(/Set)注释以排除测试是否用它标记。

参数
excludeAnnotations

添加所有排除过滤器

public void addAllExcludeFilters ( filters)

添加要排除的测试的过滤器的ERROR(/Set)

参数
filters

添加全部包含注释

public void addAllIncludeAnnotation ( annotations)

添加ERROR(/Set)注释以包含测试是否用它标记。

参数
annotations

添加所有包含过滤器

public void addAllIncludeFilters ( filters)

添加要包含的测试的过滤器的ERROR(/Set)

参数
filters

添加排除注释

public void addExcludeAnnotation (String excludeAnnotation)

添加注释以排除测试是否用它标记。

参数
excludeAnnotation String

添加排除过滤器

public void addExcludeFilter (String filter)

添加要排除的测试的过滤器。

参数
filter String

添加包含注释

public void addIncludeAnnotation (String annotation)

添加注释以包含测试是否用它标记。

参数
annotation String

添加包含过滤器

public void addIncludeFilter (String filter)

添加要包含的测试的过滤器。

参数
filter String

清除排除注释

public void clearExcludeAnnotations ()

删除当前跟踪的所有排除注释。

清除排除过滤器

public void clearExcludeFilters ()

删除当前跟踪的所有排除过滤器。

清除包含注释

public void clearIncludeAnnotations ()

删除当前跟踪的所有包含注释。

清除包含过滤器

public void clearIncludeFilters ()

删除当前跟踪的所有包含过滤器。

获取排除注释

public  getExcludeAnnotations ()

返回要排除的注释的当前ERROR(/Set)

退货

获取排除过滤器

public  getExcludeFilters ()

返回排除过滤器的当前ERROR(/Set)

退货

获取排除测试文件

public File getExcludeTestFile ()

返回包含排除的测试的文件。

退货
File

获取包含注释

public  getIncludeAnnotations ()

返回要包含的注释的当前ERROR(/Set)

退货

获取包含过滤器

public  getIncludeFilters ()

返回包含过滤器的当前ERROR(/Set)

退货

获取包含测试文件

public File getIncludeTestFile ()

返回包含所包含测试的文件。

退货
File

获取运行时提示

public long getRuntimeHint ()

返回测试的预期运行时间(以毫秒为单位)。该时间用于负载平衡分片执行

退货
long

是类或方法

public boolean isClassOrMethod (String filter)

如果字符串是类或方法的名称,则返回。

参数
filter String

退货
boolean

is参数化测试

public boolean isParameterizedTest (String filter)

返回字符串是否是参数化测试。

参数
filter String

退货
boolean

是正则表达式

public boolean isRegex (String filter)

返回字符串是否是过滤器的正则表达式。

参数
filter String

退货
boolean

跑步

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

运行测试,并将结果报告给侦听器。

参数
testInfo TestInformationTestInformation对象包含运行测试的有用信息。

listener ITestInvocationListener :测试结果的ITestInvocationListener

投掷
DeviceNotAvailableException

设置排除测试文件

public void setExcludeTestFile (File testFile)

设置排除的测试文件。不确保 testFile 存在或者是一个文件。

参数
testFile File

设置包含测试文件

public void setIncludeTestFile (File testFile)

设置包含的测试文件。不确保 testFile 存在或者是一个文件。

参数
testFile File

分裂

public  split (int shardCount)

split()的替代版本还提供尝试运行的 shardCount。这对于某些有时无法随意决定的测试运行者很有用。

参数
shardCount int :尝试的分片计数。

退货
要单独执行的子测试的集合,如果测试当前不可分片,则为null

受保护的方法

设置RunnerArgs

protected void setRunnerArgs (IRemoteAndroidTestRunner runner)

参数
runner IRemoteAndroidTestRunner