### 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:

- Callers who want to display tests use the operator<<(ITieredTextBuffer, ITest) function. This is a global function, called whenever a test is run to display the final state of the test. It is the primary interface by which tests present themselves in a human-readable form.
- Writers of ITest subclasses who wish to display data present in their subclass but absent from their base class should override the virtual framework function ITest::print. In their overriding function, they should always call the inherited print function first, so that base-class information is displayed.

    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) {}