Log.SaveResultsAs() do not work for the LogFormat lsJUnit
Hi everyone,
I would like to export JUnit report to see my summary reports in Jenkins.
Of course I read the Log.SaveResultsAs() function documentation, Viewing TestComplete Test Results in Jenkins and also Exporting Test Results , and the related documentations.
I want to export my test summary from my scripts using
Log.SaveResultsAs("C:\\Temporary jenkins workspace with spaces\\exports\\results.xml", lsJUnit, True, lesFull)
But it always returns "False", and the summary report is not exported. However, I am not doing something very complicated, and I have just called a function as it is given in the documentation as an example.
I also export logs with "lsZip" and "lsPackedHTML log formats with the same call, just adjusting the file name (and extension of course), and in that cases it works correctly.
Can you confirm if it is realy a bug of the Log.SaveResultsAs() function or if there are some specific things to do that are not written in the documentation please ?
PS: Why do I not use the /ExportSummary command line argument ?
- Because when you configure a Jenkins job to publish JUnit report you have to give a relative path to the workspace.
- Whereas the /ExportSummary argument expects an absolute path, the Jenkins workspace depends on the job name, so we can not use the command line argument because it is to heavy to edit the command line argument value each time we edit the job name (we use the job name as a test run title, so we edit it sometimes).
- Moreover we have one job per PJS, deployed from a job template, so the commande line argument value has to be set for each job.
- And in the /ExportSummary command line argument value we can not use environment variables, like the %WORKSPACE% variable which holds the running Jenkins.
Ok even if the Log.SaveResultsAs() function does not work with lsJUnit LogFormat, due to you last answer I found the way to use the command line argument /ExportSummary through the TestComplete Jenkins pluggin.
Indeed, there were several tricky points. So when you go to the plugin configuration in your job, you click on "settings", and in the command line arguments you put :
"/ExportSummary:${WORKSPACE}\results.xml"
The tricky points are :
- Even if the Jenkins server, and the slave agent, run on a Windows machine, use the UNIX syntax ${WORKSPACE} and not %WORKSPACE% (even if you use "\" and not "/" as path delimiter ... so UNIX syntax for environment variables, Windows syntax for others)
- The quotes should include the argument also : "/ExportSummary:${WORKSPACE}\results.xml" and not /ExportSummary:"${WORKSPACE}\results.xml"
Then you can specified in the post build step to publish JUnit report giving the following path : results.xml
Thanks all for your answers