Pipeline - Second JUnitResultArchiver step doesn't mark build UNSTABLE

392 views
Skip to first unread message

Lionel Orellana

unread,
Jun 28, 2016, 10:10:09 PM6/28/16
to Jenkins Users
Hello,

I have to make two different maven invocations to build my app and run some tests.

This is all within the same node/stage at the moment. 

1)  sh "${global.mvnCmd} -Dmaven.test.failure.ignore clean install "
     archive '**/*.ear, **/pom.xml'
     step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])

   
2)  sh "${global.mvnCmd} -f module/pom.xml -Dmaven.test.failure.ignore test"
     step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])


There are tests failing in the second call but the build/pipeline is not being marked as UNSTABLE even though the Test Results do show the failed tests. If I comment out 1) then the build/pipeline does get marked as UNSTABLE. 

So it appears the JUnitResultArchiver can only set the result once? 

The end goal is to run unit tests as part of 1) and exit if there are failed tests (I can check the build result which would haven been set by JUnitResultArchiver). If 1) is Ok we'll run longer tests with 2). But that will only work if JUnitResultArchiver can set the build result the a second time.

Thanks

Lionel.





Lionel Orellana

unread,
Jun 28, 2016, 11:36:29 PM6/28/16
to Jenkins Users
Had something to do with having the same surefire suite name in both calls. Hints came from comments in method add(SuiteResult sr) in TestResult.java.

I changed the suite name in the second project's pom like so

 <plugins>
           
<plugin>
               
<groupId>org.apache.maven.plugins</groupId>
               
<artifactId>maven-surefire-plugin</artifactId>
               
<version>${version.surefire.plugin}</version>
               
<configuration>
                   
<properties>
                       
<property>
                           
<name>suitename</name>
                           
<value>IntegrationSuite</value>
                       
</property>
                   
</properties>
               
</configuration>
           
</plugin>
   
</plugins>

Reply all
Reply to author
Forward
0 new messages