Skip to content

Instantly share code, notes, and snippets.

@adrienmo
Last active September 11, 2015 04:37
Show Gist options
  • Save adrienmo/9b61d8b7b4476af6cb4e to your computer and use it in GitHub Desktop.
Save adrienmo/9b61d8b7b4476af6cb4e to your computer and use it in GitHub Desktop.
Convert result of common_test into XUnit format for Jenkins use
#Output file
JUNIT_FILE=test_output.xml
#Jenkins ignores the testsuite properties, we add manually the header for the testsuite with arbitrary data
echo '<testsuites><testsuite name="App Name" tests="1" failures="0" timestamp="2012-08-23T14:40:44.874443-05:00">' > $JUNIT_FILE
#Assume there is only one run of ct_run in the logs folder
cat logs/*/*/*/suite.log |
sed '/=case \|=result/!d' |
sed 's/^=case[ ]*\(.*\)/<testcase name="\1">/g' |
sed 's/^=result[ ]*\ok/<\/testcase>/g' |
sed 's/^=result.*/<error message="error">Error<\/error><\/testcase>/g' >> $JUNIT_FILE
#Close the testsuite anchor
echo '</testsuite></testsuites>' >> $JUNIT_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment