Class TestRunner
Defined in File TestRunner.h
Class Documentation
-
class TestRunner
Manages and runs test suites.
Public Functions
-
TestRunner()
Constructs a TestRunner object.
-
void Add(TestSuite *suite)
Adds a test suite to the runner.
- Parameters:
suite – A pointer to the TestSuite to add.
-
void SetSuiteFilter(optional<string> filter)
Sets the filter for test suites.
- Parameters:
filter – An optional string containing the filter expression.
-
void SetTestFilter(optional<string> filter)
Sets the filter for individual tests.
- Parameters:
filter – An optional string containing the filter expression.
-
void SetTargetDbPath(const std::string &target_db_path)
Sets the path to the target database.
Note
This is forwarded to the internal TestEnvironment.
- Parameters:
target_db_path – The absolute path to the target database file.
-
void SetRepeatCount(uint repeat_count)
Sets the number of times each test should be repeated.
Note
This is useful for testing stability.
- Parameters:
repeat_count – The number of repetitions. Must be at least 1.
-
const vector<unique_ptr<TestSuite>> &GetTestSuites()
Gets the vector of test suites managed by the runner.
- Returns:
A constant reference to the vector of unique pointers to TestSuite objects.
-
bool Run(uint skip = 0)
Runs the test suites according to the configured filters and repeat count.
- Parameters:
skip – The number of tests to skip (in case the previous test run crashed and you don’t want to repeat the successful tests again).
- Returns:
True if all non-skipped tests passed, false otherwise.
-
void SetLogger(TestLogger *logger)
Sets the logger to be used by the test runner.
- Parameters:
logger – A pointer to the TestLogger object to use. The TestRunner takes ownership of the logger.
-
TestRunner()