Repository navigation
#49: feat: add JUnit XML report output - #66
Merged
Merged
Conversation
Write a JUnit XML file with --report junit:PATH so CI systems can show test results. One testsuite per file, one testcase per entry, named after the first comment line or the command. Skipped and fail-fast-cancelled entries, failed later asserts and finally sections, and parse errors are included; defer entries are left out. Closes #49
Background entries with the same command got the name of the last one, because the name was looked up by command string. Later and finally results now carry their entry.
Entries without a comment are named after their command, which already
holds the substituted --var values. The header shows only var names on
purpose, and CI artifacts are not masked, so the report now shows
{{NAME}} instead of the value.
An unusable report path was only found after the whole run, and turned a test-failure exit 1 into exit 2. The report file is now created before the run, so a bad path exits 2 right away. A second --report flag is rejected instead of silently replacing the first.
An entry with a skip directive was reported as cancelled by fail-fast and lost its reason. Compact mode also kept the output of every entry in memory until the end of the run, even without --report.
Suites used the display path, which is relative to the scanned directory. Files with the same name in different directories got the same suite name and classname, and the name did not match the path in parse errors. CI tools can now also link the suite to the repo file.
Mutation testing showed 13 of 31 mutations surviving. New tests cover the verbose path with --report, a skipped file with a defer entry, suite and total durations, the parse error body, a failing write, and the skip reason of a single entry.
Describe path handling, early failure, name masking and collisions, and add GitHub Actions and GitLab CI snippets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
--report junit:<path>, so CI systems can show clitest results (GitLab, Jenkins and Azure DevOps read it natively, GitHub via dorny/test-reporter).--fail-fast, failedlaterasserts, failed[finally]sections and parse errors are in the report. Defer entries are not, because they are cleanup.junitis supported. Theformat:pathvalue leaves room for more formats later, for example CTRF.nolintin the repo.Not yet checked by hand with dorny/test-reporter.
Closes #49