Skip to content

Fix JUnit output for assertion-free test cases - #3187

Open
Boulea7 wants to merge 1 commit into
catchorg:develfrom
Boulea7:fix/junit-empty-testcase
Open

Fix JUnit output for assertion-free test cases#3187
Boulea7 wants to merge 1 commit into
catchorg:develfrom
Boulea7:fix/junit-empty-testcase

Conversation

@Boulea7

@Boulea7 Boulea7 commented Aug 10, 2026

Copy link
Copy Markdown

Description

The JUnit reporter currently omits an executed test case when it completes without assertions. This makes its result disagree with the console reporter and can leave JUnit consumers with no <testcase> node even though the test ran.

This change emits a <testcase> when an executed test would otherwise produce none. The suite tests attribute is derived from the testcase nodes written by the reporter, so the declared count matches the XML output. The fallback is limited to an otherwise empty section tree, which prevents assertion-free section and generator output from receiving a duplicate root testcase.

Validation

  • Approval tests
  • Basic development suite: 82/82 tests passed
  • All-tests configuration: 141/141 tests passed
  • Direct XML checks for an empty test, an assertion-free section, an assertion-free generator, a runtime skip, and a no-match filter

GitHub Issues

Fixes #2856

AI assistance

OpenAI Codex assisted with implementation and test preparation.

Emit a testcase for executed test cases whose section tree would otherwise produce no JUnit testcase. Count the suite tests from emitted testcase nodes so the declared count matches the XML output.

Fixes catchorg#2856

Assisted-by: OpenAI Codex
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.24%. Comparing base (97ec4e8) to head (ac97fb3).

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #3187      +/-   ##
==========================================
- Coverage   91.25%   91.24%   -0.01%     
==========================================
  Files         204      204              
  Lines        8965     8986      +21     
==========================================
+ Hits         8181     8199      +18     
- Misses        784      787       +3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tteo38472

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JUnit and console reporter discrepency.

2 participants