Skip to content

Convert junit.xml into Markdown

License

Notifications You must be signed in to change notification settings

kitproj/junit2md

Repository files navigation

junit2md

Convert Junit XML reports (junit.xml) into Markdown reports using single binary.

  • Standalone binary.
  • Failed tests are top, that's what's important.
  • Looks ... good enough.

Screenshot

screenshot

Install

Like jq, junit2md is a tiny (3Mb) standalone binary. You can download it from the releases page.

If you're on MacOS, you can use brew:

brew tap kitproj/junit2md --custom-remote https://github.com/kitproj/junit2md
brew install junit2md

Otherwise, you can use curl:

curl -q https://raw.githubusercontent.com/kitproj/junit2md/main/install.sh | sh

Usage

Here is an example that uses trap to always created the test report:

go install github.com/jstemmer/go-junit-report@latest

trap 'go-junit-report < test.out > junit.xml && junit2md < junit.xml > test-report.md' EXIT

go test -v -cover ./... 2>&1 > test.out

💡 Don't use pipes (i.e. |) in shell, pipes swallow exit codes. Use < and > which is POSIX compliant.

Test

How to test this locally:

go test -v -cover ./... 2>&1 > test.out
go-junit-report < test.out > junit.xml 
go run . < junit.xml > test-report.md