Last active
August 29, 2015 14:06
-
-
Save loa/fb0ac190f4425d996bee to your computer and use it in GitHub Desktop.
Jenkins xunit blue-yellow-red
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- job-template: | |
name: 'exitcode-{exitcode}-{testresult}' | |
builders: | |
- shell: | | |
#!/bin/bash -xe | |
if [ "{testresult}" = "passed" ]; then | |
STATUS="passed" | |
NUM_FAILURE="0" | |
else | |
STATUS="failure" | |
NUM_FAILURE="1" | |
fi | |
cat > junit.xml <<EOF | |
<?xml version="1.0" encoding="UTF-8"?> | |
<testsuite errors="0" failures="${{NUM_FAILURE}}" name="foobar" skipped="0" tests="1" time="1.000000"> | |
<testcase classname="foo" name="bar" status="${{STATUS}}" time="1.000000"> | |
EOF | |
[ "${{STATUS}}" = "failure" ] && | |
echo ' <failure message="" type="AssertionError"></failure>' >> junit.xml | |
cat >> junit.xml <<EOF | |
</testcase> | |
</testsuite> | |
EOF | |
cat junit.xml | |
exit {exitcode} | |
publishers: | |
- xunit: | |
thresholdmode: 'percent' | |
thresholds: | |
- failed: | |
unstable: '0' | |
unstablenew: '0' | |
failure: '100' | |
failurenew: '100' | |
- skipped: | |
unstable: '100' | |
unstablenew: '100' | |
failure: '100' | |
failurenew: '100' | |
types: | |
- junit: | |
pattern: 'junit.xml' | |
- project: | |
name: bogusname | |
jobs: | |
- 'exitcode-{exitcode}-{testresult}' | |
testresult: | |
- 'passed' | |
- 'failed' | |
exitcode: | |
- '0' | |
- '1' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment