Skip to content

Commit

Permalink
changed the result folder for the helloWorld jUnit tests into a custo…
Browse files Browse the repository at this point in the history
…m folder
  • Loading branch information
abangau committed Aug 8, 2024
1 parent a1f0787 commit 3c8cbc2
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ public void testJUnitResults() throws Exception {
String projectName = "root-job-" + UUID.randomUUID().toString();
FreeStyleProject project = rule.createFreeStyleProject(projectName);

project.getBuildersList().add(new Maven(String.format("--settings \"%s\\conf\\settings.xml\" clean test -Dmaven.repo.local=%s\\m2-temp",
project.getBuildersList().add(new Maven(String.format("--settings \"%s\\conf\\settings.xml\" clean test -Dmaven.repo.local=%s\\m2-temp -P custom-Junit-report-location",
TestUtils.getMavenHome(), System.getenv("TEMP")), mavenName, null, null, "-Dmaven.test.failure.ignore=true"));
project.getPublishersList().add(new JUnitResultArchiver("**/target/surefire-reports/*.xml"));
project.getPublishersList().add(new JUnitResultArchiver("**/custom-Junit-report-location/*.xml"));
project.setScm(new CopyResourceSCM("/helloWorldRoot"));
AbstractBuild build = TestUtils.runAndCheckBuild(project);

Expand All @@ -98,9 +98,9 @@ public void testJUnitResultsPom() throws Exception {
String projectName = "root-job-" + UUID.randomUUID().toString();
FreeStyleProject project = rule.createFreeStyleProject(projectName);

project.getBuildersList().add(new Maven(String.format("--settings \"%s\\conf\\settings.xml\" clean test -Dmaven.repo.local=%s\\m2-temp",
project.getBuildersList().add(new Maven(String.format("--settings \"%s\\conf\\settings.xml\" clean test -Dmaven.repo.local=%s\\m2-temp -P custom-Junit-report-location",
TestUtils.getMavenHome(), System.getenv("TEMP")), mavenName, "subFolder/helloWorld/pom.xml", null, "-Dmaven.test.failure.ignore=true"));
project.getPublishersList().add(new JUnitResultArchiver("**/target/surefire-reports/*.xml"));
project.getPublishersList().add(new JUnitResultArchiver("**/custom-Junit-report-location/*.xml"));
project.setScm(new CopyResourceSCM("/helloWorldRoot", "subFolder"));
AbstractBuild build = TestUtils.runAndCheckBuild(project);

Expand All @@ -112,9 +112,9 @@ public void testJUnitResultsTwoPoms() throws Exception {
String projectName = "root-job-" + UUID.randomUUID().toString();
FreeStyleProject project = rule.createFreeStyleProject(projectName);

project.getBuildersList().add(new Maven(String.format("--settings \"%s\\conf\\settings.xml\" clean test -Dmaven.repo.local=%s\\m2-temp",
project.getBuildersList().add(new Maven(String.format("--settings \"%s\\conf\\settings.xml\" clean test -Dmaven.repo.local=%s\\m2-temp -P custom-Junit-report-location",
TestUtils.getMavenHome(), System.getenv("TEMP")), mavenName, "pom.xml", null, "-Dmaven.test.failure.ignore=true"));
project.getPublishersList().add(new JUnitResultArchiver("**/target/surefire-reports/*.xml"));
project.getPublishersList().add(new JUnitResultArchiver("**/custom-Junit-report-location/**.xml"));
project.setScm(new CopyResourceSCM("/helloWorldRoot"));
AbstractBuild build = TestUtils.runAndCheckBuild(project);

Expand All @@ -128,9 +128,9 @@ public void testJUnitResultsLegacy() throws Exception {
project.runHeadless();

project.setMaven(mavenName);
project.setGoals(String.format("clean test --settings \"%s\\conf\\settings.xml\" -Dmaven.repo.local=%s\\m2-temp -Dmaven.test.failure.ignore=true",
project.setGoals(String.format("clean test --settings \"%s\\conf\\settings.xml\" -P custom-Junit-report-location -Dmaven.repo.local=%s\\m2-temp -Dmaven.test.failure.ignore=true",
TestUtils.getMavenHome(), System.getenv("TEMP")));
project.getPublishersList().add(new JUnitResultArchiver("**/target/surefire-reports/*.xml"));
project.getPublishersList().add(new JUnitResultArchiver("**/custom-Junit-report-location/**.xml"));
project.setScm(new CopyResourceSCM("/helloWorldRoot"));
AbstractBuild build = TestUtils.runAndCheckBuild(project);

Expand All @@ -145,7 +145,7 @@ public void testJUnitResultsLegacyWithoutJUnitArchiver() throws Exception {
project.runHeadless();

project.setMaven(mavenName);
project.setGoals(String.format("clean test --settings \"%s\\conf\\settings.xml\" -Dmaven.repo.local=%s\\m2-temp -Dmaven.test.failure.ignore=true",
project.setGoals(String.format("clean test --settings \"%s\\conf\\settings.xml\" -P custom-Junit-report-location -Dmaven.repo.local=%s\\m2-temp -Dmaven.test.failure.ignore=true",
TestUtils.getMavenHome(), System.getenv("TEMP")));
project.setScm(new CopyResourceSCM("/helloWorldRoot"));
AbstractBuild build = TestUtils.runAndCheckBuild(project);
Expand All @@ -161,9 +161,9 @@ public void testJUnitResultsLegacySubfolder() throws Exception {

project.setMaven(mavenName);
project.setRootPOM("subFolder/helloWorld/pom.xml");
project.setGoals(String.format("clean test --settings \"%s\\conf\\settings.xml\" -Dmaven.repo.local=%s\\m2-temp -Dmaven.test.failure.ignore=true",
project.setGoals(String.format("clean test --settings \"%s\\conf\\settings.xml\" -P custom-Junit-report-location -Dmaven.repo.local=%s\\m2-temp -Dmaven.test.failure.ignore=true",
TestUtils.getMavenHome(), System.getenv("TEMP")));
project.getPublishersList().add(new JUnitResultArchiver("**/target/surefire-reports/*.xml"));
project.getPublishersList().add(new JUnitResultArchiver("**/custom-Junit-report-location/**.xml"));
project.setScm(new CopyResourceSCM("/helloWorldRoot", "subFolder"));
AbstractBuild build = TestUtils.runAndCheckBuild(project);

Expand All @@ -190,9 +190,9 @@ public void testJUnitResultsFreeStyleModule() throws Exception {
String projectName = "root-job-" + UUID.randomUUID().toString();
FreeStyleProject project = rule.createFreeStyleProject(projectName);

project.getBuildersList().add(new Maven(String.format("--settings \"%s\\conf\\settings.xml\" clean test -Dmaven.repo.local=%s\\m2-temp",
project.getBuildersList().add(new Maven(String.format("--settings \"%s\\conf\\settings.xml\" clean test -Dmaven.repo.local=%s\\m2-temp -P custom-Junit-report-location",
TestUtils.getMavenHome(), System.getenv("TEMP")), mavenName, null, null, "-Dmaven.test.failure.ignore=true"));
project.getPublishersList().add(new JUnitResultArchiver("**/target/surefire-reports/*.xml"));
project.getPublishersList().add(new JUnitResultArchiver("**/custom-Junit-report-location/**.xml"));
project.setScm(new CopyResourceSCM("/helloWorldRoot"));
AbstractBuild build = TestUtils.runAndCheckBuild(project);

Expand All @@ -207,10 +207,10 @@ public void testJUnitResultsMatrixProject() throws Exception {
MatrixProject matrixProject = rule.createProject(MatrixProject.class, projectName);
matrixProject.setAxes(new AxisList(new Axis(axisParamName, subtypes)));

matrixProject.getBuildersList().add(new Maven(String.format("--settings \"%s\\conf\\settings.xml\" clean test -Dmaven.test.failure.ignore=true -Dmaven.repo.local=%s\\m2-temp -X",
matrixProject.getBuildersList().add(new Maven(String.format("--settings \"%s\\conf\\settings.xml\" clean test -Dmaven.test.failure.ignore=true -Dmaven.repo.local=%s\\m2-temp -X -P custom-Junit-report-location",
TestUtils.getMavenHome(), System.getenv("TEMP")), mavenName));

matrixProject.getPublishersList().add(new JUnitResultArchiver("**/target/surefire-reports/*.xml"));
matrixProject.getPublishersList().add(new JUnitResultArchiver("**/custom-Junit-report-location/**.xml"));
matrixProject.setScm(new CopyResourceSCM("/helloWorldRoot"));
MatrixBuild build = (MatrixBuild) TestUtils.runAndCheckBuild(matrixProject);

Expand Down
16 changes: 16 additions & 0 deletions src/test/resources/helloWorldRoot/helloWorld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@
</plugin>
</plugins>
</reporting>
<profiles>
<profile>
<id>custom-Junit-report-location</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<reportsDirectory>${project.build.directory}/foo/bar/custom-Junit-report-location</reportsDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
Expand Down
16 changes: 16 additions & 0 deletions src/test/resources/helloWorldRoot/helloWorld2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@
</plugin>
</plugins>
</reporting>
<profiles>
<profile>
<id>custom-Junit-report-location</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<reportsDirectory>${project.build.directory}/foo/bar/custom-Junit-report-location</reportsDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
Expand Down

0 comments on commit 3c8cbc2

Please sign in to comment.