hurl/integration/report.sh

37 lines
1022 B
Bash
Raw Normal View History

2020-11-08 19:52:33 +03:00
#!/bin/bash
# Generate a unique html report
# Each hurl file will be run successively, result is appended to the same json file
set +e
2021-11-26 22:22:57 +03:00
rm -rf build
mkdir build
export HURL_name=Bob
2020-11-08 19:52:33 +03:00
find tests -name "*.hurl" | sort | while read -r hurl_file; do
2021-11-26 22:22:57 +03:00
options=("--report-html build/html" "--report-junit build/tests.xml" "--json" )
2020-11-08 19:52:33 +03:00
if test -f "${hurl_file%.*}.options"; then
options+=("$(cat "${hurl_file%.*}.options")")
fi
cmd="hurl $hurl_file ${options[*]}"
echo "$cmd"
2021-11-26 22:22:57 +03:00
$cmd >> "build/tests.json"
2020-11-08 19:52:33 +03:00
exit_code=$?
2021-11-26 22:22:57 +03:00
if [[ "$exit_code" != 0 && "$exit_code" != 3 && "$exit_code" != 4 ]]; then
echo "unexpected exit code $exit_code"
exit 1
2020-11-08 19:52:33 +03:00
fi
2021-11-26 22:22:57 +03:00
done
total=$(ls tests/*.hurl | wc -l)
total_in_json=$(cat build/tests.json | wc -l)
total_in_xml=$(cat build/tests.xml | xmllint --xpath '//testcase' - | grep 'testcase id' | wc -l)
2021-11-26 22:22:57 +03:00
# Do not fail yet
echo "Total Number of tests"
echo "Hurl files: $total"
echo "Tests in JSON: $total_in_json"
echo "Tests in XML: $total_in_xml"
2020-11-08 19:52:33 +03:00