Skip to content

Instantly share code, notes, and snippets.

@kimkevin
Created March 26, 2018 15:44
Show Gist options
  • Save kimkevin/a06e6d135406cc1af5af9215f5c25fa3 to your computer and use it in GitHub Desktop.
Save kimkevin/a06e6d135406cc1af5af9215f5c25fa3 to your computer and use it in GitHub Desktop.
Parsing summary group in index.html of test report
#!/bin/bash
get_value() {
value=$(echo $1 | sed "s/.*\>\(.*\)\<.*/\1/")
}
summary=$(grep -A1 "infoBox" test.html | sed -e "s/--//g" | tr '\n' " " | perl -p -e 's/\s\s/\n/g')
while read -r line; do
if [ "$line" ];
then
get_value "$line"
if [[ $line == *\"tests\"* ]]; then
tests=$value
elif [[ $line == *\"failures\"* ]]; then
failures=$value
elif [[ $line == *\"duration\"* ]]; then
duration=$value
elif [[ $line == *\"successRate\"* ]]; then
successRate=$value
fi
fi
done <<< "$summary"
echo $tests
echo $failures
echo $duration
echo $successRate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment