"lib/bindings/python/vscode:/vscode.git/clone" did not exist on "bd8f0804737847cc3d09db7aec29ee3e3233b30b"
Commit f465aca3 authored by Pavithra Vijayakrishnan's avatar Pavithra Vijayakrishnan Committed by GitHub
Browse files

ci: Improve summarizing the test report (#153)

parent 0694d6b5
...@@ -44,10 +44,42 @@ jobs: ...@@ -44,10 +44,42 @@ jobs:
run_id: ${{ github.event.workflow_run.id }} run_id: ${{ github.event.workflow_run.id }}
path: artifacts path: artifacts
- name: Publish Test Results - name: Summarize Test Results as Markdown Table
uses: EnricoMi/publish-unit-test-result-action@170bf24d20d201b842d7a52403b73ed297e6645b # v2.18.0 run: |
with: sudo apt-get update -y
commit: ${{ github.event.workflow_run.head_sha }} sudo apt-get install -y libxml2-utils
event_file: artifacts/Event File/event.json echo "## Unit Test Results Summary" >> $GITHUB_STEP_SUMMARY
event_name: ${{ github.event.workflow_run.event }} echo "# This test report is a summary of the test run in workflow run: [${{ steps.set_test_run_url.outputs.test_run_url }}](${{ steps.set_test_run_url.outputs.test_run_url }})" >> $GITHUB_STEP_SUMMARY
files: "artifacts/**/*.xml" echo "| Test Suite | Tests | Passed | Failed | Skipped | Duration |" >> $GITHUB_STEP_SUMMARY
\ No newline at end of file echo "|------------|-------|--------|--------|---------|----------|" >> $GITHUB_STEP_SUMMARY
total_tests=0
total_passed=0
total_failed=0
total_skipped=0
total_duration=0
for file in artifacts/**/*.xml; do
if [ -f "$file" ]; then
suite_name=$(basename "$(dirname "$file")")
tests=$(xmllint --xpath "count(//testcase)" "$file")
passed=$(xmllint --xpath "count(//testcase[not(failure) and not(error) and not(skipped)])" "$file")
failed=$(xmllint --xpath "count(//testcase[failure or error])" "$file")
skipped=$(xmllint --xpath "count(//testcase[skipped])" "$file")
duration=$(xmllint --xpath "sum(//testcase/@time)" "$file")
# Debugging: Output values for each file
echo "Processing file: $file"
echo "Suite: $suite_name, Tests: $tests, Passed: $passed, Failed: $failed, Skipped: $skipped, Duration: $duration"
echo "| $suite_name | $tests | $passed | $failed | $skipped | ${duration}s |" >> $GITHUB_STEP_SUMMARY
total_tests=$((total_tests + tests))
total_passed=$((total_passed + passed))
total_failed=$((total_failed + failed))
total_skipped=$((total_skipped + skipped))
total_duration=$(echo "$total_duration + $duration" | bc)
fi
done
echo "Total tests: $total_tests"
echo "Total passed: $total_passed"
echo "Total failed: $total_failed"
echo "Total skipped: $total_skipped"
echo "Total duration: $total_duration"
echo "|------------|-------|--------|--------|---------|----------|" >> $GITHUB_STEP_SUMMARY
echo "| **Total** | $total_tests | $total_passed | $total_failed | $total_skipped | ${total_duration}s |" >> $GITHUB_STEP_SUMMARY
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment