testCount() method from fcf::NTest::State class
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.2
Returns the number of tests currently selected for execution.
The
This count reflects the number of tests that will be processed by the runner after all filters (parts, groups, tests, and ignore selectors) have been applied.
Result
- The number of selected tests.
Example: Getting the count of selected tests
Demonstrating how to check how many tests are scheduled to run.
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
FCF_TEST_DEFINE ("CountDemo", "Info", "CheckCount") {
// 1. Access the global state
fcf::NTest::State & currentState = fcf::NTest::state ();
// 2. Get the number of selected tests
size_t count = currentState.testCount ();
// 3. Output the result
fcf::NTest::log () << "Total tests to run: " << count << std::endl;
FCF_TEST (true);
}
int main(int a_argc, char* a_argv[]) {
bool error = false;
fcf::NTest::cmdRun (a_argc, a_argv, fcf::NTest::CRM_RUN , &error);
return error ? 1 : 0;
}
Output:
Performing the test: "CountDemo" -> "Info" -> "CheckCount" ...
> Total tests to run: 1
[SUCCESS] Test completed successfully (0.000`006`089 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 0.000`006`089 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.