use of org.gradle.api.tasks.testing.TestFilter in project gradle by gradle.
the class TestExecutionBuildConfigurationAction method configureBuildForInternalJvmTestRequest.
private List<Test> configureBuildForInternalJvmTestRequest(GradleInternal gradle, TestExecutionRequestAction testExecutionRequest) {
final Collection<InternalJvmTestRequest> internalJvmTestRequests = testExecutionRequest.getInternalJvmTestRequests();
if (internalJvmTestRequests.isEmpty()) {
return Collections.emptyList();
}
List<Test> tasksToExecute = new ArrayList<Test>();
final Set<Project> allprojects = gradle.getRootProject().getAllprojects();
for (Project project : allprojects) {
final Collection<Test> testTasks = project.getTasks().withType(Test.class);
for (Test testTask : testTasks) {
for (InternalJvmTestRequest jvmTestRequest : internalJvmTestRequests) {
final TestFilter filter = testTask.getFilter();
filter.includeTest(jvmTestRequest.getClassName(), jvmTestRequest.getMethodName());
}
}
tasksToExecute.addAll(testTasks);
}
return tasksToExecute;
}
Aggregations