当前位置: 首页>>代码示例>>Java>>正文


Java TestTaskReports类代码示例

本文整理汇总了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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:67,代码来源:TaskManager.java


注:本文中的org.gradle.api.tasks.testing.TestTaskReports类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。