本文整理汇总了Java中org.gradle.api.tasks.testing.TestTaskReports类的典型用法代码示例。如果您正苦于以下问题:Java TestTaskReports类的具体用法?Java TestTaskReports怎么用?Java TestTaskReports使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestTaskReports类属于org.gradle.api.tasks.testing包,在下文中一共展示了TestTaskReports类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUnitTestTask
import org.gradle.api.tasks.testing.TestTaskReports; //导入依赖的package包/类
private void createUnitTestTask(@NonNull TaskFactory tasks,
@NonNull final TestVariantData variantData) {
final BaseVariantData testedVariantData =
(BaseVariantData) variantData.getTestedVariantData();
final Test runTestsTask = project.getTasks().create(
variantData.getScope().getTaskName(UNIT_TEST.getPrefix()),
Test.class);
runTestsTask.setGroup(JavaBasePlugin.VERIFICATION_GROUP);
runTestsTask.setDescription(
"Run unit tests for the " +
testedVariantData.getVariantConfiguration().getFullName() + " build.");
fixTestTaskSources(runTestsTask);
runTestsTask.dependsOn(variantData.assembleVariantTask);
final AbstractCompile testCompileTask = variantData.javacTask;
runTestsTask.setTestClassesDir(testCompileTask.getDestinationDir());
ConventionMappingHelper.map(runTestsTask, "classpath",
new Callable<ConfigurableFileCollection>() {
@Override
public ConfigurableFileCollection call() throws Exception {
Iterable<File> filteredBootClasspath = Iterables.filter(
androidBuilder.getBootClasspath(),
new Predicate<File>() {
@Override
public boolean apply(@Nullable File file) {
return file != null &&
!SdkConstants.FN_FRAMEWORK_LIBRARY
.equals(file.getName());
}
});
return project.files(
testCompileTask.getClasspath(),
testCompileTask.getOutputs().getFiles(),
variantData.processJavaResourcesTask.getOutputs(),
testedVariantData.processJavaResourcesTask.getOutputs(),
filteredBootClasspath,
// Mockable JAR is last, to make sure you can shadow the classes
// withdependencies.
createMockableJar.getOutputFile());
}
});
// Put the variant name in the report path, so that different testing tasks don't
// overwrite each other's reports.
TestTaskReports testTaskReports = runTestsTask.getReports();
for (ConfigurableReport report : new ConfigurableReport[] {
testTaskReports.getJunitXml(), testTaskReports.getHtml()}) {
report.setDestination(new File(report.getDestination(), testedVariantData.getName()));
}
tasks.named(JavaPlugin.TEST_TASK_NAME, new Action<Task>() {
@Override
public void execute(Task test) {
test.dependsOn(runTestsTask);
}
});
extension.getTestOptions().getUnitTests().applyConfiguration(runTestsTask);
}