Casperjs export XML to Jenkins

I have successfully set up a casperjs test exporting result.xml file.

In Jenkins, I am running the following shell command:

casperjs /home/testing-radu/generated-test.js

      

This creates "results.xml" in my build workspace.

In the post-build actions, I added "Publish XUnit Test Results Report". I don't know how or where to set the path to the XML file.

When my build console I see the following:

[37;42;1mPASS 2 tests executed in 9.96s, 2 passed, 0 failed.                             [0m
[32;1mResult log stored in results.xml                                                [0m
[xUnit] [INFO] - Starting to record.
ERROR: Publisher org.jenkinsci.plugins.xunit.XUnitPublisher aborted due to exception
/var/lib/jenkins/jobs/17live2/workspace/generatedJUnitFiles does not exist.

      

I added full rights to the workspace directory. I tried to create a "generated folder JUnitFiles" and this is what I get:

[37;42;1mPASS 2 tests executed in 5.296s, 2 passed, 0 failed.                            [0m
[32;1mResult log stored in results.xml                                                [0m
[xUnit] [INFO] - Starting to record.
[xUnit] [INFO] - Setting the build status to FAILURE
[xUnit] [INFO] - Stopping recording.
Build step 'Publish xUnit test result report' changed build result to FAILURE
Finished: FAILURE

      

Am I missing something?

+3


source to share


1 answer


Ok, here's the deal:

In the published XUnit test results, I selected JUnit (also set the template to * .xml) and then created a wrapper script to execute Jenkins:

# Auth tests
for f in auth/*.js ; do casperjs "$f"; done;

# Clean the old results and place the new ones
rm /var/lib/jenkins/jobs/17live2/workspace/*.xml
mv *.xml /var/lib/jenkins/jobs/17live2/workspace/

      



In Jenkins config, I just do: ./run.sh

*** You need read and write permissions for your folders.

+3


source







All Articles