@Incubating interface TestFilter
Allows filtering tests for execution. Some examples:
apply plugin: 'java' test { filter { //specific test class, this can match 'SomeTest' class and corresponding method under any package includeTestsMatching "SomeTest" includeTestsMatching "SomeTest.someTestMethod*" //specific test class includeTestsMatching "org.gradle.SomeTest" //specific test class and method includeTestsMatching "org.gradle.SomeTest.someSpecificFeature" includeTest "org.gradle.SomeTest", "someTestMethod" //specific test method, use wildcard includeTestsMatching "*SomeTest.someSpecificFeature" //specific test class, wildcard for packages includeTestsMatching "*.SomeTest" //all classes in package, recursively includeTestsMatching "com.gradle.tooling.*" //all integration tests, by naming convention includeTestsMatching "*IntegTest" //only ui tests from integration tests, by some naming convention includeTestsMatching "*IntegTest*ui" } }
Since
1.10
abstract fun getIncludePatterns(): MutableSet<String>
Returns the included test name patterns. They can be class or method names and may contain wildcard '*'. Test name patterns can be appended via |
|
abstract fun includeTest(className: String, methodName: String): TestFilter
Add a test method specified by test class name and method name. |
|
abstract fun includeTestsMatching(testNamePattern: String): TestFilter
Appends a test name pattern to the filter. Wildcard '*' is supported, either test method name or class name is supported. Examples of test names: "com.foo.FooTest.someMethod", "com.foo.FooTest", "*FooTest*", "com.foo*". See examples in the docs for TestFilter. |
|
abstract fun isFailOnNoMatchingTests(): Boolean
Returns whether the task should fail if no matching tests where found. The default is true. |
|
abstract fun setFailOnNoMatchingTests(failOnNoMatchingTests: Boolean): Unit
Let the test task fail if a filter configuration was provided but no test matched the given configuration. |
|
abstract fun setIncludePatterns(vararg testNamePatterns: String): TestFilter
Sets the test name patterns to be included in the filter. Wildcard '*' is supported. Replaces any existing test name patterns. |