XmlOutputter:write user defined mesgs in XML?

  • Arti Gujare

    Arti Gujare - 2006-10-26

    Dear All,

    I am using CPPUnit::XmlOutputter to write the unit test results to an XML file.
    The program works as expected and I can see the test results in the xml file.
    But I also want to add intermediate results and user defined messages in the same xml result file.
    How do I do that in my Test function?
    // my code is
            CppUnit::TextTestRunner runner;
        std::ofstream outputFile("testResults.xml");
        CppUnit::XmlOutputter* outputter = new CppUnit::XmlOutputter( &runner.result(),
            outputFile );   


    // MyTestClass is derived from CppUnit::TestFixture and uses CPPUNIT_TEST_SUITE macros.
    // I need to write the progress status to the output xml file while the test is runnin


    Thanks a ton,
    Arti gujare

    • Felix Deutsch

      Felix Deutsch - 2006-10-28

      Use the approach similar to the one suggested by the cppunit maintainer for associating test descriptions with testcases:

    • michelleb

      michelleb - 2006-11-02

      You can look into XmlOutputterHook (Hook to customize Xml output).  I've used it to add custom info into the xml output.  This class has methods to add info in the beginning or end of report, for each failed / successful test, or in statistics.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks