FCF 2.0 development in progress...
> > > > > >
[News] [C++ Libraries API] [C++ Downloads] [Donate to the project] [Contacts]

fixtures() method from fcf::NTest::Storage class

std::vector<fcf::NTest::Fixture> fixtures() const

Class: fcf::NTest::Storage

Package: fcfTest

File: test.hpp

Available from version: 1.2.2

Returns a collection of all registered test fixtures.

The fixtures method provides access to the registry of all setup and teardown operations currently configured in the framework.

Result
std::vector<fcf::NTest::Fixture>
- A vector containing all registered fcf::NTest::Fixture objects.

Example: Inspecting Registered Fixtures

Demonstrating how to retrieve and iterate through all registered fixtures.

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> #include <iostream> FCF_TEST_BEFORE_DEFINE("Global", "All", "*", fcf::NTest::FL_GLOBAL) { fcf::NTest::log() << "Global Setup" << std::endl; } FCF_TEST_DEFINE("Global", "All", "Test") { FCF_TEST(true); } int main(int a_argc, char* a_argv[]) { bool error = false; fcf::NTest::Storage& storage = fcf::NTest::storage(); // 1. Retrieve all fixtures std::vector<fcf::NTest::Fixture> allFixtures = storage.fixtures(); fcf::NTest::log() << "Total fixtures registered: " << allFixtures.size() << std::endl; for(const auto& f : allFixtures) { fcf::NTest::log() << " - Level: " << f.level << " (Before: " << (f.before ? "Yes" : "No") << ")" << std::endl; } fcf::NTest::cmdRun(a_argc, a_argv, fcf::NTest::CRM_RUN, &error); return error ? 1 : 0; }

Output:

> Total fixtures registered: 1 > - Level: 0 (Before: Yes) > Global Setup Performing the test: "Global" -> "All" -> "Test" ... [SUCCESS] Test completed successfully (0.000`000`486 sec) [SUCCESS] All tests were completed. Tests: 1 passed, 0 failed, 0 skipped, 1 total Duration: 0.000`000`486 sec