Test Filter
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"
//exclude a specific test by its name
excludeTestsMatching "*canDoSomethingSpecific"
//excluding tests by name also works for test names which have spaces
excludeTestsMatching "*can do something specific"
}
}
Content copied to clipboard
Since
1.10
Functions
Link copied to clipboard
Excludes a test method specified by test class name and method name.
Link copied to clipboard
Appends a test name pattern to the exclusion filter.
Link copied to clipboard
Returns the excluded test name patterns.
Link copied to clipboard
Returns the included test name patterns.
Link copied to clipboard
Add a test method specified by test class name and method name.
Link copied to clipboard
Appends a test name pattern to the inclusion filter.
Link copied to clipboard
Returns whether the task should fail if no matching tests where found.
Link copied to clipboard
Sets the test name patterns to be excluded in the filter.
Link copied to clipboard
Let the test task fail if a filter configuration was provided but no test matched the given configuration.
Link copied to clipboard
Sets the test name patterns to be included in the filter.