Manasjyoti Bhuyan
Manasjyoti Bhuyan

Reputation: 93

Unable to do robot framework reports collection in Jenkins

I'm trying to run 4 test scripts in parallel. I want to store the output.xml file for each test script in the following manner-

 Test_1 -> output1.xml
 Test_2 -> output2.xml
 .
 .
 Test_4 -> output3.xml

and combine them together and generate one single report.html file I'm getting some errors related to the output.xml file location.

There is my script in Jenkins to run the robot-

pipeline {
    agent any
    triggers {
        cron('H */4 * * 1-5')
    }
    stages {
        stage('Testing') {
            parallel{
                stage('Testing- Operator') {
                        steps { 
                               sh '''robot //var//jenkins_home//workspace//Testing_Operator//Operator.robot 
                               robot  archiveDirName:\'robot-plugin\',logFileName: \'**/log*.html\',outputFileName:\'**/output*.xml\',outputPath:\'/var/jenkins_home/workspace/Testing_Pipeline\',overwriteXAxisLabel: \'\',reportFileName:\'**/report*.html\''''  
                        }
                }
                
                stage('Testing -Manager') {
                        steps {
                               sh '''robot //var//jenkins_home//workspace//Testing_Manger//Manager.robot 
                               robot  archiveDirName:\'robot-plugin\',logFileName: \'**/log*.html\',outputFileName:\'**/output*.xml\',outputPath:\'/var/jenkins_home/workspace/Testing_Pipeline\',overwriteXAxisLabel: \'\',reportFileName:\'**/report*.html\''''  
                        }
                }
                
                stage('Testing -Admin') {
                        steps {
                               sh '''robot //var//jenkins_home//workspace//Testing_Admin//Admin.robot 
                               robot  archiveDirName:\'robot-plugin\',logFileName: \'**/log*.html\',outputFileName:\'**/output*.xml\',outputPath:\'/var/jenkins_home/workspace/Testing_Pipeline\',overwriteXAxisLabel: \'\',reportFileName:\'**/report*.html\''''  
                        }
                }
                
                stage('Testing -Owner') {
                        steps {
                                sh '''robot //var//jenkins_home//workspace//Testing_Owner//Owner.robot 
                                robot  archiveDirName:\'robot-plugin\',logFileName: \'**/log*.html\',outputFileName:\'**/output*.xml\',outputPath:\'/var/jenkins_home/workspace/Testing_Pipeline\',overwriteXAxisLabel: \'\',reportFileName:\'**/report*.html\''''  
                        }       
                }
            }
        }
    }        
}    

Here is the error-

Output: /var/jenkins_home/workspace/Testing_Pipeline/output.xml
[ ERROR ] Reading XML source '/var/jenkins_home/workspace/Testing_Pipeline/output.xml' failed: ParseError: not well-formed (invalid token): line xx, column xx

What could be the possible cause of the error? Is the syntax correct?

Upvotes: 2

Views: 973

Answers (1)

Helio
Helio

Reputation: 3737

Probably the output.xml is broken due to running robot in parallel.

What you can do is for all the robot commands to use the flag for a different output path (or filename), and in a final stage call rebot to produce the final report and logs.

Upvotes: 1

Related Questions