Skip to content

Instantly share code, notes, and snippets.

@diegolovison
Last active May 31, 2018 19:24
Show Gist options
  • Save diegolovison/ae434e014e8b9ea66d2168e9567e62b8 to your computer and use it in GitHub Desktop.
Save diegolovison/ae434e014e8b9ea66d2168e9567e62b8 to your computer and use it in GitHub Desktop.
Counting Surefire Results
DIR=$1
num=0
skipped=0
failures=0
for file in $(find $DIR -name 'TEST-*.xml')
do
if [[ -f $file ]]; then
num=$((num + $(xmllint --xpath 'string(/testsuite/@tests)' $file)))
current_skipped=$(xmllint --xpath 'string(/testsuite/@skipped)' $file)
failures=$((failures + $(xmllint --xpath 'string(/testsuite/@failures)' $file)))
if [ -z "$current_skipped" ]
then
current_skipped=0
fi
skipped=$((skipped + current_skipped))
fi
done
echo "tests: $num"
echo "skipped: $skipped"
echo "failures: $failures"
echo "run: $((num - skipped))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment