How to publish Junit report folder in Jenkins UI

567 Views Asked by At

I am trying to run Testim tests with Jenkins. For which i have created a Jenkins Pipeline job. I am able to run it successfully but not able to publish a report. I am trying to publish junit report, for that i am using following build command

node {
if(Names){
  def nameFlags  = Names.split(',').collect { " --name \"${it.trim()}\" "}
  def browserFlags = Browser_Configuration.split(',').collect { " --test-config \"${it.trim()}\" " }
  bat "testim --host localhost --port 4444 --mode selenium --token \"xxxxx\" --project \"xxxx\" --params-file \".\\testdata.js\" ${nameFlags.join(' ')} ${browserFlags.join(' ')} --report-file test-results/testim-tests-$BUILD_NUMBER-report.xml"
}else if(Suits){
    def suitFlags  = Suits.split(',').collect { " --suite \"${it.trim()}\" " }
    def browserFlags = Browser_Configuration.split(',').collect { " --test-config \"${it.trim()}\" " }
    bat "testim --host localhost --port 4444 --mode selenium --token \"xxx\" --project \"xxxx\" --params-file \".\\testdata.js\" ${suitFlags.join(' ')} ${browserFlags.join(' ')} --report-file test-results/testim-tests-$BUILD_NUMBER-report.xml"
}
junit checksName: 'Reports', testResults: 'test-results/*.xml'
}

By using this code, i am able to see the generated xml file in the workspace folder. But it is not publishing in Jenkins UI. How can i publish the report in Jenkins UI for this Testim's test.

1

There are 1 best solutions below

0
On

Please use post pipeline section in order to publish testim results to Jenkins UI. E.g.:

 post{
    always {
        junit 'test-results/*.xml'
    }

enter image description here