Add support for easily querying the suite and test name from within a test body

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • Fully Compatible
    • Programmability 2025-08-04
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In both mongotest and gtest, it's quite a mouthful to get the suite and test name from within a unit test's body. In the former, it's UnitTest::getInstance()->currentTestInfo()->suiteName() and UnitTest::getInstance()->currentTestInfo()->testName(), although some tests will inappropriately access the _agent pseudoprivate member variable of the test fixture base class to find the test info struct. In the latter, it's no better: UnitTest::GetInstance()->current_test_info()->test_suite_name() and UnitTest::GetInstance()->current_test_info()->name().

      To ease both the gtest port process and future unit test writing, define and implement free functions in the unit testing namespace that grab the suite and test name. Replace uses of _agent that query for these fields with uses of these new functions.

            Assignee:
            James Bronsted
            Reporter:
            James Bronsted
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: