fcf::NTest::Storage class
Type:
class fcf::NTest::Storage
Package: fcfTest
File: test.hpp
Available from version: 1.2.1
A thread-safe central repository for all registered tests, fixtures, and execution metadata.
The
Methods
- Sets or gets the execution priority of a specific test group.
- Filters and selects a subset of registered tests based on provided selectors and ignore rules.
- Registers a new test case into the global storage.
- Returns a collection of all registered test fixtures.
- Registers a new test fixture into the global storage.
- Returns or sets all parameters associated with a specific test.
- Adds a parameters to a specific test case.
template <typename ...TValuePack>
void
appendParamValue (const std::string & a_partName, const std::string & a_groupName, const std::string & a_testName, const TValuePack & ...a_parameterPack)
template <typename ...TValuePack>
void
appendParamValue (const fcf::NTest::Test & a_a_test, const TValuePack & ...a_parameterPack)
template <typename ...TValuePack>
void
appendParamValue (const fcf::NTest::TestPath & a_testPath, const TValuePack & ...a_parameterPack)
- Adds a values as a parameters to a specific test case by automatically wrapping it in fcf::NTest::SharedPtrAny .
Example: Manual Storage Management
Demonstrates how to manually interact with the Storage instance to register tests, set execution orders.
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
#include <iostream>
void myManualTest(){
// Access the global storage instance
fcf::NTest::Storage & storage = fcf::NTest::storage ();
// Get the group serial number
int partOrder = storage.partOrder ("Manual");
FCF_TEST(partOrder == 1, partOrder);
}
int main(int a_argc, char* a_argv[]) {
// 1. Access the global storage instance
fcf::NTest::Storage & storage = fcf::NTest::storage ();
// 2. Register a custom execution order for this part
storage.partOrder ("Manual", 1);
// 3.Register a manual test
fcf::NTest::Test test;
test.part = "Manual";
test.group = "Storage";
test.test = "Test";
test.testFunction = myManualTest;
storage.appendTest (test);
// 4. Starting test processing
bool error = false;
fcf::NTest::cmdRun (a_argc, a_argv, fcf::NTest::CRM_RUN , &error);
return error ? 1 : 0;
}
Output:
Performing the test: "Manual" -> "Storage" -> "Test" ...
[SUCCESS] Test completed successfully (0.000`000`768 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 0.000`000`768 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.