[CXX-1938] Catch does not guarantee running at least one test SECTION per TEST_CASE run Created: 12/Feb/20  Updated: 28/Oct/23  Resolved: 18/Feb/20

Status: Closed
Project: C++ Driver
Component/s: Testing
Affects Version/s: None
Fix Version/s: 3.5.0

Type: Bug Priority: Major - P3
Reporter: Samantha Ritter (Inactive) Assignee: Samantha Ritter (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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.



 Comments   
Comment by Githook User [ 18/Feb/20 ]

Author:

{'name': 'samantharitter', 'username': 'samantharitter', 'email': 'samantha.ritter@10gen.com'}

Message: CXX-1938 Move test assertions inside SECTIONs
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/b1157ffeaa45740ad6e72e5778421e41bb1b20e7

Generated at Wed Feb 07 22:04:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.