Skip to content
Permalink
Browse files
Added regression test for broken Maven 2 builds with maven-failsafe-p…
…lugin [JENKINS-15865]
  • Loading branch information
kutzi authored and jglick committed Oct 4, 2013
1 parent d026fb4 commit bd4a5ae9beb93865f825b6801fdfbf94dcddc364
@@ -6,9 +6,14 @@
import hudson.model.Result;
import hudson.model.StringParameterDefinition;
import hudson.tasks.Maven.MavenInstallation;
import hudson.tasks.test.AbstractTestResultAction;
import hudson.tasks.test.AggregatedTestResultAction;
import hudson.tasks.test.TestResultProjectAction;

import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.Map;

import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.Email;
@@ -145,6 +150,33 @@ public void testBuildTimeStampProperty() throws Exception {
assertFalse( content.contains( "${maven.build.timestamp}") );

System.out.println( "content " + content );
}

@Bug(value=15865)
public void testMavenFailsafePluginTestResultsAreRecorded() throws Exception {

// GIVEN: a Maven project with maven-failsafe-plugin and Maven 2.2.1
MavenModuleSet mavenProject = createMavenProject();
MavenInstallation mavenInstallation = configureDefaultMaven();
mavenProject.setMaven(mavenInstallation.getName());
mavenProject.getReporters().add(new TestReporter());
mavenProject.setScm(new ExtractResourceSCM(getClass().getResource("JENKINS-15865.zip")));
mavenProject.setGoals( "clean install" );

// WHEN project is build
MavenModuleSetBuild mmsb = buildAndAssertSuccess(mavenProject);

// THEN we have a testresult recorded
AggregatedTestResultAction aggregatedTestResultAction = mmsb.getAggregatedTestResultAction();
assertNotNull(aggregatedTestResultAction);
assertEquals(1, aggregatedTestResultAction.getTotalCount());

Map<MavenModule, MavenBuild> moduleBuilds = mmsb.getModuleLastBuilds();
assertEquals(1, moduleBuilds.size());
MavenBuild moduleBuild = moduleBuilds.values().iterator().next();
AbstractTestResultAction<?> testResultAction = moduleBuild.getTestResultAction();
assertNotNull(testResultAction);
assertEquals(1, testResultAction.getTotalCount());
}

private static class TestReporter extends MavenReporter {
Binary file not shown.

0 comments on commit bd4a5ae

Please sign in to comment.