Search This Blog

Breaking

Friday, 23 April 2021

[Jenkin] -> Showing Junit Test results in Jenkin Build page


If you are using JUnit in your testing framework along with the surefire plugin for generating reports, then there is a beautiful way to show these reports in Jenkin console from your pipeline job. 

You just need to put one line in your script:

 junit  '**/target/surefire-reports/*.xml'


If you are using Karate framework, then this piece of code will solve your purpose:



stage('Build') {

                   try {

    bat '''mvn clean test -DargLine='-Dkarate.env=QA-US' -Dkarate.options="--tags @SmokeAPI" -Dtest=CucumberReport -DfailIfNoTests=false'''

                   }  finally {

        junit  '**/target/surefire-reports/*.xml'

    }

}   


Once you will add this code, your test result will come in this way in Jenkins build console:











No comments:

Post a Comment