LMC_LAUNCH_GROUP from enum fcf::NTest::ELogMessageCategory
Value: fcf::NTest::LMC_LAUNCH_GROUP
= 0x00020000
Enum: fcf::NTest::ELogMessageCategory
Package: fcfTest
File:
test.hpp
Available from version: 1.1.14
The category for messages related to the lifecycle of an individual test case, such as its start, descriptive messages, and completion.
The fcf::NTest::LMC_LAUNCH_GROUP category is dedicated to tracking the execution flow of each individual test case. It is used by the framework to signal when a specific test begins and ends, providing clear visual separation in the logs between different test runs.
This group typically includes:
- LMC_LAUNCH_START: Indicates the beginning of a test case.
- LMC_LAUNCH_START_MESSAGE: A descriptive message explaining what is about to be tested.
- LMC_LAUNCH_END: Indicates the conclusion of a test case.
By filtering for this category, you can isolate the 'per-test' overhead and lifecycle events from the general system logs or the actual test results.
Example: Isolating Test Lifecycle Logs
Demonstrates how to use a custom prefix that only appears during the launch phase of a test, helping to visually highlight when a new test starts.
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
#include <iostream>
void initialize() {
// 1. Access the global logger
fcf::NTest::Logger& logger = fcf::NTest::logger();
// 2. Clear existing prefixes for a clean demonstration
logger.clearPrefixes(true);
// 3. Add a special prefix that ONLY applies to the LAUNCH group
// This will make the 'Performing the test...' message stand out.
fcf::NTest::Logger::Prefix prefix;
prefix.name = "test-start-marker";
prefix.multiLine = false;
prefix.category = fcf::NTest::LMC_LAUNCH_GROUP;
prefix.prefix = ">> [STARTING TEST] ";
logger.appendPrefix(prefix);
}
FCF_TEST_DECLARE("LaunchDemo", "Lifecycle", "LaunchPrefixTest") {
// 4. Log a message using the LAUNCH_START_MESSAGE category
// This message will be prefixed with our custom marker
fcf::NTest::log(fcf::NTest::LMC_LAUNCH_START_MESSAGE) << "Initializing test environment..." << std::endl;
// 5. Log a standard message using the USER_GROUP
// This message will NOT have the ">> [STARTING TEST]" prefix
fcf::NTest::log(fcf::NTest::LMC_USER_GROUP) << "This is a normal user log." << std::endl;
}
int main(int a_argc, char* a_argv[]) {
initialize();
bool error = false;
fcf::NTest::cmdRun(a_argc, a_argv, fcf::NTest::CRM_RUN, &error);
return error ? 1 : 0;
}
Output:
>> [STARTING TEST] Performing the test: "LaunchDemo" -> "Lifecycle" -> "LaunchPrefixTest" ...
>> [STARTING TEST] Initializing test environment...
> This is a normal user log.
[SUCCESS] Test completed successfully (0.000`005`542 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 0.000`005`542 sec