Displaying Internal Test Information by Overriding ITest::print

The Test Framework provides a means by which test classes can display internal information in a textual format. This mechanism works in two ways:

class IMyTest: public ITest {
    ...
protected:
    void print(ITieredTextBuffer&);
private:
    double fImportantValue; // This is important and should be shown
};

void IMyTest::print(ITieredTextBuffer& out)
{
    ITest::print(out); // First show base class information
    out << "tmytest important value=" << fImportantValue << '\n';
    // Always end with a '\n'.
}

The content of the print function is printed only when you set the echo tier level equal to or below ITieredTextBuffer::kDetail (you set it through the command line). Remember that the default echo tier level is ITieredTextBuffer::kNormal.

mytest -t IMyTest -e dTest IMyTest (PASS) // sets echo tier level 

{	run count: 1
	info: {}
	input: {}
	TMyTest important value=100
}

If you don't include the -e option, you will see this

mytest -t IMyTest 
Test IMyTest (PASS) {}