Stay organized with collections
Save and categorize content based on your preferences.
UnitTestSuiteBuilder
open class UnitTestSuiteBuilder : TestSuiteBuilder
A suite builder that finds unit tests.
Summary
Inherited functions |
From class TestSuiteBuilder
TestSuite! |
build()
Call this method once you've configured your builder as desired.
|
TestSuiteBuilder! |
excludePackages(vararg packageNames: String!)
Exclude all tests in the given packages and all sub-packages, unless otherwise specified.
|
String! |
getSuiteName()
Subclasses use this method to determine the name of the suite.
|
TestSuiteBuilder! |
includeAllPackagesUnderHere()
Include all junit tests that satisfy the requirements in the calling class' package and all sub-packages.
|
TestSuiteBuilder! |
includePackages(vararg packageNames: String!)
Include all tests that satisfy the requirements in the given packages and all sub-packages, unless otherwise specified.
|
TestSuiteBuilder! |
named(newSuiteName: String!)
Override the default name for the suite being built. This should generally be called if you call addRequirements(com.android.internal.util.Predicate[]) to make it clear which tests will be included. The name you specify is automatically prefixed with the package containing the tests to be run. If more than one package is specified, the first is used.
|
|
Public constructors
UnitTestSuiteBuilder
UnitTestSuiteBuilder(clazz: Class<Any!>!)
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[],[],null,["# UnitTestSuiteBuilder\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nUnitTestSuiteBuilder\n====================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/test/suitebuilder/UnitTestSuiteBuilder \"View this page in Java\") \n\n```\nopen class UnitTestSuiteBuilder : TestSuiteBuilder\n```\n\n|---|---|-----------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||\n| ↳ | [android.test.suitebuilder.TestSuiteBuilder](/reference/kotlin/android/test/suitebuilder/TestSuiteBuilder) ||\n| | ↳ | [android.test.suitebuilder.UnitTestSuiteBuilder](#) |\n\n*** ** * ** ***\n\n| **This class was deprecated in API level 31.**\n|\n| android.test.runner is obsolete\n\nA suite builder that finds unit tests.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [UnitTestSuiteBuilder](#UnitTestSuiteBuilder(java.lang.Class))`(`clazz:` `[Class](../../../java/lang/Class.html#)\u003c[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!\u003e!`)` \u003cbr /\u003e |\n| [UnitTestSuiteBuilder](#UnitTestSuiteBuilder(kotlin.String,%20java.lang.ClassLoader))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `classLoader:` `[ClassLoader](../../../java/lang/ClassLoader.html#)!`)` \u003cbr /\u003e |\n\n| Inherited functions ||\n|---|---|\n| From class [TestSuiteBuilder](/reference/kotlin/android/test/suitebuilder/TestSuiteBuilder) |-----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | TestSuite! | [build](/reference/kotlin/android/test/suitebuilder/TestSuiteBuilder#build())`()` Call this method once you've configured your builder as desired. \u003cbr /\u003e | | [TestSuiteBuilder](/reference/kotlin/android/test/suitebuilder/TestSuiteBuilder)! | [excludePackages](/reference/kotlin/android/test/suitebuilder/TestSuiteBuilder#excludePackages(kotlin.String))`(`vararg` `packageNames:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Exclude all tests in the given packages and all sub-packages, unless otherwise specified. \u003cbr /\u003e | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getSuiteName](/reference/kotlin/android/test/suitebuilder/TestSuiteBuilder#getSuiteName())`()` Subclasses use this method to determine the name of the suite. \u003cbr /\u003e | | [TestSuiteBuilder](/reference/kotlin/android/test/suitebuilder/TestSuiteBuilder)! | [includeAllPackagesUnderHere](/reference/kotlin/android/test/suitebuilder/TestSuiteBuilder#includeAllPackagesUnderHere())`()` Include all junit tests that satisfy the requirements in the calling class' package and all sub-packages. \u003cbr /\u003e | | [TestSuiteBuilder](/reference/kotlin/android/test/suitebuilder/TestSuiteBuilder)! | [includePackages](/reference/kotlin/android/test/suitebuilder/TestSuiteBuilder#includePackages(kotlin.String))`(`vararg` `packageNames:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Include all tests that satisfy the requirements in the given packages and all sub-packages, unless otherwise specified. \u003cbr /\u003e | | [TestSuiteBuilder](/reference/kotlin/android/test/suitebuilder/TestSuiteBuilder)! | [named](/reference/kotlin/android/test/suitebuilder/TestSuiteBuilder#named(kotlin.String))`(`newSuiteName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Override the default name for the suite being built. This should generally be called if you call `addRequirements(com.android.internal.util.Predicate[])` to make it clear which tests will be included. The name you specify is automatically prefixed with the package containing the tests to be run. If more than one package is specified, the first is used. \u003cbr /\u003e | ||\n\nPublic constructors\n-------------------\n\n### UnitTestSuiteBuilder\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nUnitTestSuiteBuilder(clazz: Class\u003cAny!\u003e!)\n``` \n\n### UnitTestSuiteBuilder\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nUnitTestSuiteBuilder(\n name: String!, \n classLoader: ClassLoader!)\n```"]]