Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1938

Catch does not guarantee running at least one test SECTION per TEST_CASE run

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.0
    • Affects Version/s: None
    • Component/s: Testing
    • Labels:
      None

      In some of our tests, we assume that Catch will run at least one SECTION on every run through a test case, and we put SECTION-dependent code at the end of the test case (for example, having many SECTIONS that each call a method with different options, then REQUIREing at the end of the TEST_CASE that the operation got called).

      However, Catch may sometimes run through a TEST_CASE without iterating any of its sections.  Apparently this used to be the default behavior and happened on every run; now it only happens occasionally, when the test framework can't figure out if it has already iterated all SECTIONs.  In any case, running exactly one SECTION per test case run is not a guarantee that Catch makes.  See this github thread: https://github.com/catchorg/Catch2/issues/552 

      We will need to change our tests so they don't assert things outside of SECTIONs that rely upon a SECTION having been run.

            Assignee:
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Reporter:
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: