Junit reporter: sections are mixed up when expression fails
- Dominant language
- C++
- Stars
- 21.5k
- Forks
- 3.5k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 2
Description
When using the Junit reporter and nested sections, test case names are generated in the form "outer section/nested section level 1/..." a.s.o.
When any expression in the whole test case fails, this seems to be broken.
Minimal test case to reproduce the problem:
```
TEST_CASE( "catch a bug" )
{
SECTION( "outer section" )
{
SECTION( "inner section 1" ) { REQUIRE( 1 == 1 ); }
SECTION( "inner section 2" ) { REQUIRE( 2 == 2 ); }
}
}
```
produces
```
```
However,
```
TEST_CASE( "catch a bug" )
{
SECTION( "outer section" )
{
SECTION( "inner section 1" ) { REQUIRE( 1 == 1 ); }
SECTION( "inner section 2" ) { REQUIRE( 2 == 3 ); }
}
}
```
produces
```
at ../libs/adasmath/test/camera_models.cpp:81
```
Note the section names
**outer section/inner section 1**
**outer section/inner section 2**
vs.
**inner section 2/inner section 1**
**inner section 2/outer section**.
Contributor guide
Research direction
Start by running the provided nested-section reproducer with Catch2's JUnit reporter and compare the generated testcase names for passing and failing expressions. Trace how the reporter receives section names during the failure case. Done means the failing output preserves the expected outer section/inner section order for both test cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100