Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Junit reporter: sections are mixed up when expression fails #417

Open
tom-bola opened this issue May 18, 2015 · 0 comments
Open

Junit reporter: sections are mixed up when expression fails #417

tom-bola opened this issue May 18, 2015 · 0 comments

Comments

@tom-bola
Copy link

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

<testsuites>
  <testsuite name="all tests" errors="0" failures="0" tests="2" hostname="tbd" time="6.4e-05" timestamp="tbd">
    <testcase classname="catch a bug" name="outer section/inner section 1" time="0.000013"/>
    <testcase classname="catch a bug" name="outer section/inner section 2" time="0.000004"/>
    <system-out/>
    <system-err/>
  </testsuite>
</testsuites>

However,

TEST_CASE( "catch a bug" )
{
        SECTION( "outer section" )
        {
            SECTION( "inner section 1" ) { REQUIRE( 1 == 1 ); }
            SECTION( "inner section 2" ) { REQUIRE( 2 == 3 ); }
        }
}

produces

<testsuites>
  <testsuite name="all tests" errors="0" failures="1" tests="2" hostname="tbd" time="0.000109" timestamp="tbd">
    <testcase classname="catch a bug" name="inner section 2/inner section 1" time="0.000014"/>
    <testcase classname="catch a bug" name="inner section 2/outer section" time="0.000042">
      <failure message="2 == 3" type="REQUIRE">at ../libs/adasmath/test/camera_models.cpp:81      </failure>
    </testcase>
    <system-out/>
    <system-err/>
  </testsuite>
</testsuites>

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.

@tom-bola tom-bola changed the title Junit reporter: sections are mixed Junit reporter: sections are mixed up when expression fails May 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants