|
ORE Studio 0.0.4
|
Catch2 event listener that sets up logging for each test case and logs all test events to Boost.Log files. More...
#include <logging_listener.hpp>
Inherits EventListenerBase.

Public Member Functions | |
| std::string | extract_suite_name (const Catch::TestCaseInfo &testInfo) |
| Extracts the first tag from a Catch2 test case as the suite name. | |
| std::string | extract_module_name () |
| Extracts the module name from the test binary name. | |
| void | testRunStarting (Catch::TestRunInfo const &testRunInfo) override |
| void | testRunEnded (Catch::TestRunStats const &testRunStats) override |
| void | testCaseStarting (Catch::TestCaseInfo const &testInfo) override |
| void | testCaseEnded (Catch::TestCaseStats const &testCaseStats) override |
| void | assertionEnded (Catch::AssertionStats const &assertionStats) override |
| void | sectionStarting (Catch::SectionInfo const §ionInfo) override |
| void | sectionEnded (Catch::SectionStats const §ionStats) override |
Static Public Member Functions | |
| static void | set_test_module_name (const std::string &module_name) |
| Sets the test module name from the main function. | |
Catch2 event listener that sets up logging for each test case and logs all test events to Boost.Log files.
This listener automatically initializes the logging infrastructure before each test case starts and cleans it up when the test completes. It also logs all Catch2 test events (test start/end, sections, assertions) to the Boost.Log file.
The listener must be registered in each test's main.cpp file using: CATCH_REGISTER_LISTENER(ores::utility::test::logging_listener)
In your tests, use logger() to access the current test's logger:
TEST_CASE("my_test", "[my_suite]") { BOOST_LOG_SEV(logger(), info) << "Test message"; }
| std::string extract_suite_name | ( | const Catch::TestCaseInfo & | testInfo | ) |
Extracts the first tag from a Catch2 test case as the suite name.
If no tags are present, returns "default_suite".
| std::string extract_module_name | ( | ) |
Extracts the module name from the test binary name.
Assumes the binary follows the pattern "ores.*.tests"