Most visited

Recently visited

Added in API level 1

TestSuiteBuilder

public class TestSuiteBuilder
extends Object

java.lang.Object
   ↳ android.test.suitebuilder.TestSuiteBuilder


根据包含的软件包,排除的软件包和必须满足的谓词的组合来构建套件。

Summary

Nested classes

class TestSuiteBuilder.FailedToCreateTests

一个特殊的TestCase用于在构建()步骤中指示失败。

Public constructors

TestSuiteBuilder(Class clazz)

给定的名称将自动添加包含要运行的测试的包。

TestSuiteBuilder(String name, ClassLoader classLoader)

Public methods

TestSuiteBuilder addRequirements(List<Predicate<TestMethod>> predicates)

排除不能满足所有给定谓词的测试。

final TestSuiteBuilder addRequirements(Predicate...<TestMethod> predicates)

排除不能满足所有给定谓词的测试。

final TestSuite build()

根据需要配置好构建器后调用此方法。

TestSuiteBuilder excludePackages(String... packageNames)

排除给定包和所有子包中的所有测试,除非另有说明。

final TestSuiteBuilder includeAllPackagesUnderHere()

包括所有符合调用类包和所有子包的要求的junit测试。

TestSuiteBuilder includePackages(String... packageNames)

除非另有说明,否则包括满足给定包和所有子包中的要求的所有测试。

TestSuiteBuilder named(String newSuiteName)

覆盖正在构建的套件的默认名称。

Protected methods

String getSuiteName()

子类使用此方法来确定套件的名称。

Inherited methods

From class java.lang.Object

Public constructors

TestSuiteBuilder

Added in API level 1
TestSuiteBuilder (Class clazz)

给定的名称将自动添加包含要运行的测试的包。 如果指定了多个包,则使用第一个。

Parameters
clazz Class: Use the class from your .apk. Use the class name for the test suite name. Use the class' classloader in order to load classes for testing. This is needed when running in the emulator.

TestSuiteBuilder

Added in API level 1
TestSuiteBuilder (String name, 
                ClassLoader classLoader)

Parameters
name String
classLoader ClassLoader

Public methods

addRequirements

Added in API level 1
TestSuiteBuilder addRequirements (List<Predicate<TestMethod>> predicates)

排除不能满足所有给定谓词的测试。

Parameters
predicates List: Predicates to add to the list of requirements.
Returns
TestSuiteBuilder The builder for method chaining.

addRequirements

Added in API level 1
TestSuiteBuilder addRequirements (Predicate...<TestMethod> predicates)

排除不能满足所有给定谓词的测试。 如果您调用此方法,那么您可能还想调用named(String)来覆盖默认套件名称。

Parameters
predicates Predicate: Predicates to add to the list of requirements.
Returns
TestSuiteBuilder The builder for method chaining.

build

Added in API level 1
TestSuite build ()

根据需要配置好构建器后调用此方法。

Returns
TestSuite The suite containing the requested tests.

excludePackages

Added in API level 1
TestSuiteBuilder excludePackages (String... packageNames)

排除给定包和所有子包中的所有测试,除非另有说明。

Parameters
packageNames String: Names of packages to remove.
Returns
TestSuiteBuilder The builder for method chaining.

includeAllPackagesUnderHere

Added in API level 1
TestSuiteBuilder includeAllPackagesUnderHere ()

包括所有符合调用类包和所有子包的要求的junit测试。

Returns
TestSuiteBuilder The builder for method chaining.

includePackages

Added in API level 1
TestSuiteBuilder includePackages (String... packageNames)

除非另有说明,否则包括满足给定包和所有子包中的要求的所有测试。

Parameters
packageNames String: Names of packages to add.
Returns
TestSuiteBuilder The builder for method chaining.

named

Added in API level 1
TestSuiteBuilder named (String newSuiteName)

覆盖正在构建的套件的默认名称。 如果您打电话给addRequirements(com.android.internal.util.Predicate[])以明确哪些测试将包含在内,通常应该调用它。 您指定的名称将自动添加包含要运行的测试的包。 如果指定了多个包,则使用第一个。

Parameters
newSuiteName String: Prefix of name to give the suite being built.
Returns
TestSuiteBuilder The builder for method chaining.

Protected methods

getSuiteName

Added in API level 1
String getSuiteName ()

子类使用此方法来确定套件的名称。

Returns
String The package and suite name combined.

Hooray!