private static void configureTestReports(Test testTask, Map<String, Object> properties) { File testResultsDir = testTask.getReports().getJunitXml().getDestination(); // do not set a custom test reports path if it does not exists, otherwise SonarQube will emit an error // do not set a custom test reports path if there are no files, otherwise SonarQube will emit a warning if (testResultsDir.isDirectory() && asList(testResultsDir.list()).stream().anyMatch(file -> TEST_RESULT_FILE_PATTERN.matcher(file).matches())) { appendProp(properties, "sonar.junit.reportPaths", testResultsDir); // For backward compatibility appendProp(properties, "sonar.junit.reportsPath", testResultsDir); appendProp(properties, "sonar.surefire.reportsPath", testResultsDir); } }
private static void configureTestReports(Test testTask, Map<String, Object> properties) { File testResultsDir = testTask.getReports().getJunitXml().getDestination(); // do not set a custom test reports path if it does not exists, otherwise SonarQube will emit an error // do not set a custom test reports path if there are no files, otherwise SonarQube will emit a warning if (testResultsDir.isDirectory() && asList(testResultsDir.list()).stream().anyMatch(file -> TEST_RESULT_FILE_PATTERN.matcher(file).matches())) { appendProp(properties, "sonar.junit.reportPaths", testResultsDir); // For backward compatibility appendProp(properties, "sonar.junit.reportsPath", testResultsDir); appendProp(properties, "sonar.surefire.reportsPath", testResultsDir); } }
private void configurePluginsForArtifacts(Project project) { String circleArtifactsDir = System.getenv("CIRCLE_ARTIFACTS"); if (circleArtifactsDir == null) { project.getLogger().info("$CIRCLE_ARTIFACTS variable is not set, not configuring junit/profiling reports"); return; } try { Files.createDirectories(Paths.get(circleArtifactsDir), PERMS_ATTRIBUTE); } catch (IOException e) { throw new RuntimeException("failed to create CIRCLE_ARTIFACTS directory", e); } project.getRootProject().allprojects(proj -> proj.getTasks().withType(Test.class, test -> { test.getReports().getHtml().setEnabled(true); test.getReports().getHtml().setDestination(junitPath(circleArtifactsDir, test.getPath())); })); }
@Override void configure(Task task) { super.configure(task); Task prepareMonitorEnvTask = project.getTasks().findByName(AzurePlugin.PREPARE_MONITOR_ENV_TASK); Test t = (Test)task; t.setDescription("Test execution of the azureTest source set against production deployment."); t.dependsOn(prepareMonitorEnvTask); t.setClasspath(sourceSet.getRuntimeClasspath()); t.setTestClassesDirs(sourceSet.getOutput().getClassesDirs()); t.systemProperty("testEnvPath", azure.getMonitorEnvFile().get().getAsFile().getAbsolutePath()); t.setBinResultsDir(new File(project.getBuildDir(), "monitor-test-results/binary/test")); t.getReports().getHtml().setDestination(new File(project.getBuildDir(), "reports/monitor-test-results" )); t.getReports().getJunitXml().setDestination(new File(project.getBuildDir(), "monitor-test-results" )); } }
test.getReports().getJunitXml().setEnabled(true); test.getReports().getJunitXml().setDestination(junitPath(circleReportsDir, test.getPath())); }); proj.getTasks().withType(Checkstyle.class, checkstyle ->
TestTaskReports testTaskReports = runTestsTask.getReports();