class TestResultCollector

Inherits: TestOutput

Pure result accumulation without I/O.

Implements TestOutput to collect test results that can later be written to various formats.

Public

Methods

~TestResultCollector

~TestResultCollector() noexcept override = default

DoOnSuiteStart

void DoOnSuiteStart(const String &suiteName) override

Triggered when a test suite starts executing.

suiteName
Name of the test suite being executed.

DoOnSuiteEnd

void DoOnSuiteEnd(const String &suiteName, u32 totalTestCount, u32 passedTestCount, u32 failedTestCount, u64 durationUs) override

Triggered when a test suite finishes executing.

suiteName
Name of the test suite that finished.
totalTestCount
Total number of tests in the suite.
passedTestCount
Number of tests that passed.
failedTestCount
Number of tests that failed.
durationUs
Total execution time in microseconds.

DoOnTestStart

void DoOnTestStart(const String &testName) override

Triggered when an individual test starts executing.

testName
Name of the test being executed.

DoOnTestEnd

void DoOnTestEnd(const String &testName, bool passed, u64 durationUs) override

Triggered when an individual test finishes executing.

testName
Name of the test that finished.
passed
True if the test passed, false if it failed.
durationUs
Execution time in microseconds.

DoOnOutputFail

void DoOnOutputFail(const String &description, const String &function, const String &file, long line) override

Triggered when a unit test fails.

description
Reason why the unit test failed.
function
Name of the function the test failed in.
file
File the unit test failed in.
line
Line of code the unit test failed on.

DoOnOutputSuccess

void DoOnOutputSuccess(const String &testName) override

Triggered when a unit test succeeds (optional to implement).

testName
Name of the test that succeeded.

GetResults

const Vector<TestSuiteResult> &GetResults() const

Returns all collected test suite results.

HasFailures

bool HasFailures() const

Returns true if any test has failed.

GetExitCode

i32 GetExitCode() const

Returns 0 if all tests passed, 1 if any failed.

Private

Fields

mResults

Vector<TestSuiteResult> mResults

mCurrentSuite

TestSuiteResult mCurrentSuite

mCurrentTest

TestResult mCurrentTest

mHadFailures

bool mHadFailures