Handle JUnit <error> result state in parse_testcase()#134
Open
Handle JUnit <error> result state in parse_testcase()#134
Conversation
87a359d to
0b350c8
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #134 +/- ##
==========================================
+ Coverage 84.16% 84.50% +0.33%
==========================================
Files 26 26
Lines 1295 1323 +28
Branches 156 157 +1
==========================================
+ Hits 1090 1118 +28
Misses 134 134
Partials 71 71 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Previously, test cases with an <error> element were silently classified as "passed" because the if/elif/else chain only checked for <skipped> and <failure>. This is a false-positive verdict — errors indicate unexpected exceptions or infrastructure crashes, not passing tests. - Add explicit handling for the <error> element in parse_testcase() - Add CSS styling for the tr_error result type (orange) - Also fix potential None in failure text (use `or ""` guard) - Add test fixture and test case for error state parsing Closes #132
0b350c8 to
20764c0
Compare
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.
Summary
Fixes #132
parse_testcase()now explicitly handles the JUnit<error>element, which represents unexpected exceptions or infrastructure crashes<error>test cases were silently classified as"passed"(false-positive verdict)tr_errorresult type (orange, distinct from failure red and skip gray)Nonetext in<failure>elements (consistency with the<skipped>branch)Changes
sphinxcontrib/test_reports/junitparser.py— Addelif hasattr(testcase, "error")branch before theelseclausesphinxcontrib/test_reports/css/common.css— Addtr_errorrow and status badge stylestests/doc_test/utils/xml_data_error.xml— New test fixture with all four result statestests/test_junit_parser.py— Newtest_parse_error_xml()covering error parsingTest plan
test_parse_error_xmlverifies error result, type, message, and text extraction"tr_" + resultpattern handles the new state automatically