fix(junit): count generated test cases - #457
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughJUnit XML reporting now counts failures by distinct filename. Unit test expectations, sample output, and the changelog reflect the corrected grouped testcase counts. ChangesJUnit reporting
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
aaronliu0130
left a comment
There was a problem hiding this comment.
I would prefer us grouping testcases by error category, but this is better than before so I'll approve this after a few minor changes.
androvonx95
left a comment
There was a problem hiding this comment.
Rechecked at b4371d2.
The narrowed change matches the review direction: failures is unique files with findings, changelog wording updated, and num_errors left as the raw error-message count. With only lint findings, tests/failures now match the emitted <testcase> count (e.g. 3 findings in 2 files → failures=2, tests=2, two testcases). Unit test testJUnitXML passes; full suite 206 passed.
LGTM.
yangfan-yf-yf
left a comment
There was a problem hiding this comment.
Reviewed at b4371d2.
This fixes #431's reported mismatch: lint findings are serialized as one failing testcase per file, and failures plus tests now use that same grouping. The unchanged process-error path is outside #431's lint-finding scope.
Verified locally:
python -m pytest -q --no-cov
231 passed
git diff --check b4371d2^..b4371d2
Passed
LGTM.
Summary
tests,failures, anderrorsfrom the generated test cases instead of individual lint findingsRoot cause
FormatJUnitXML()groups all lint findings for a file into one<testcase>with one<failure>, but the suite attributes were calculated from the raw finding lists. JUnit consumers therefore saw many more tests and failures than the XML actually contained.The suite counts now match the emitted structure: one error testcase when process errors exist, and one failed testcase per file containing lint findings.
Fixes #431
Validation
python -m pytest --no-cov cpplint_unittest.py -k testJUnitXML -vvpython -m pytest --no-cov 'cpplint_clitest.py::TestNoRepoSignature::test_samples[silly-junit]' -vvpython -m pytest— 231 passed, 96.46% coveragepython -m pylint cpplint.pypython -m mypy cpplint.py cpplint_clitest.py cpplint_unittest.pypre-commit run --all-filesgit diff --checkAI assistance disclosure
OpenAI Codex was used to investigate the issue, draft the implementation and regression updates, and run the validation commands listed above.
Summary by CodeRabbit
Bug Fixes
Documentation