Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using multiple JUnit results file on Jenkins pipeline

On my Jenkins pipleline I run unit tests on both: debug and release configurations. Each test configuration generates separate JUnit XML results file. Test names on both: debug and release configuration are same. Currently I use the following junit command in order to show test results:

junit allowEmptyResults: true, healthScaleFactor: 0.0, keepLongStdio: true, testResults: 'Test-Dir/Artifacts/test_xml_reports_*/*.xml'

The problem is that on Jenkins UI both: debug and release tests results are shown together and it is not possible to know which test (from debug or release configuration) is failed. Is it possible to show debug and release tests results separately? If yes, how can I do that?

like image 374
Dima Avatar asked Jan 26 '17 10:01

Dima


People also ask

Where does Jenkins store test results?

You get to the Test Result page by clicking a build link on the Status or History page of your Jenkins project, or by clicking Test Result in the menu on the left.

What is JUnit in Jenkins pipeline?

The JUnit plugin provides a publisher that consumes XML test reports generated during the builds and provides some graphical visualization of the historical test results (see JUnit graph for a sample) as well as a web UI for viewing test reports, tracking failures, and so on.


1 Answers

We run the same integration tests against two different configurations with different DB types. We use maven and the failsafe plugin, so I take advantage of the -Dsurefire.reportNameSuffix so I can see the difference between the two runs.

The following is an example block of our Jenkinsfile:

    stage('Integration test MySql') {
        steps {
            timeout(75) {
                sh("mvn -e verify -DskipUnitTests=true -DtestConfigResource=conf/mysql-local.yaml " +
                    "-DintegrationForkCount=1 -DdbInitMode=migrations -Dmaven.test.failure.ignore=false " +
                    "-Dsurefire.reportNameSuffix=MYSQL")
            }
        }
        post {
            always {
                junit '**/failsafe-reports/*MYSQL.xml'
            }
        }
    }

In the report, the integration tests run against mysql then show up with MYSQL appended to their name.

like image 196
sporkthrower Avatar answered Sep 20 '22 19:09

sporkthrower