Test Spec
Provides infrastructure to select which test classes, methods, and packages will be included in the test execution.
A complex example:
TestLauncher testLauncher = projectConnection.newTestLauncher();
testLauncher.withTestsFor(specs -> {
specs.forTaskPath(":test") // configure the test selection on the ':test' task
.includePackage("org.pkg") // execute all tests declared the org.pkg package and its sub-packages
.includeClass("com.MyTest") // execute the MyTest test class
.includeMethod("com.OtherTest", Arrays.asList("verify")) // execute the OtherTest.verify() test method
.includePattern("io.*") // execute all tests matching to io.*
}).run();
Content copied to clipboard
All methods on this interface (including the class and method selection) support patterns as arguments. The patterns follow the rules of test filtering.
The test execution will fail if any of the selected classes, methods, or patters have no matching tests.
Since
7.6
Functions
Link copied to clipboard
Adds the target test class to the test execution.
Link copied to clipboard
Adds the target test classes to the test execution.
Link copied to clipboard
Adds the target test method to the test execution.
Link copied to clipboard
Adds the target test methods to the test execution.
Link copied to clipboard
Adds all tests declared in the target package to the test execution.
Link copied to clipboard
Adds all tests declared in the target packages to the test execution.
Link copied to clipboard
Adds all test classes and methods to the test execution that matches the target pattern.
Link copied to clipboard
Adds all test classes and methods to the test execution that matches the target patterns.