Untitled
unknown
plain_text
6 months ago
837 B
2
Indexable
#!/bin/bash # Bash script to count missed and covered lines from a JaCoCo XML test report # Check if an input file is provided if [ $# -eq 0 ]; then echo "Usage: $0 <jacoco-xml-file>" exit 1 fi XMLFILE="$1" # Verify that the file exists if ! [ -f "$XMLFILE" ]; then echo "Error: File '$XMLFILE' does not exist." exit 1 fi # Check if xmllint is installed if ! command -v xmllint >/dev/null 2>&1; then echo "Error: 'xmllint' is not installed. Please install it and try again." exit 1 fi # Extract and sum up the missed and covered lines using XPath expressions MISSED_LINES=$(xmllint --xpath 'sum(//counter[@type="LINE"]/@missed)' "$XMLFILE") COVERED_LINES=$(xmllint --xpath 'sum(//counter[@type="LINE"]/@covered)' "$XMLFILE") # Output the results echo "Missed Lines: $MISSED_LINES" echo "Covered Lines: $COVERED_LINES"
Editor is loading...
Leave a Comment