Boost logo

Boost Users :

From: hfye-wila_at_[hidden]
Date: 2006-06-09 13:27:35


Hi Johan,

The command line options I know of are:

    char * argv[] = { // defaults:
        "--build_info=yes", // no
    // "--catch_system_errors=no", // yes
    // "--detect_memory_leaks=0", // 1
    // "--log_format=XML", // HRF
        "--log_level=messages", // all_errors
    // "--no_result_code=no", // yes
        "--output_format=XML", // HRF (overrides log_format &
report_format)
        "--random=1", // 0
    // "--report_format=XML", // HRF
        "--report_level=detailed", // confirm
    // "--show_progress=yes" }; // no
    
To output to files, I use set_stream. I found it made things easier to have
my own version of Boost.Test's "main" function, like this:

    // based on: "main" in <boost\test\impl\unit_test_main.ipp>
    int my_unit_test_entrypoint() {
        using namespace ::boost::unit_test;
        int ret = boost::exit_exception_failure;
        try {
            char * argv[] = { /*add cmdline options here*/ }; // see above
            int argc = sizeof( argv ) / sizeof( char * );

            framework::init( argc, argv );

            std::ofstream logStream( "c:\\log.xml" );
            unit_test_log.set_stream( logStream );

            framework::run();

            std::ofstream reportStream( "c:\\report.xml" );
            results_reporter::set_stream( reportStream );

            results_reporter::make_report();

            if ( runtime_config::no_result_code() ) {
                ret = boost::exit_success;
            } else {
                test_unit_id id = framework::master_test_suite().p_id;
                ret = results_collector.results( id ).result_code();
            }
        }
        catch( std::logic_error const & ex ) { /*add error reporting here*/
}
        catch( ... ) { /*add error reporting here*/ }
        return ret;
    }

Hope this helps!

John Fearnside
 
-----Original Message-----
From: Johan Nilsson [mailto:r.johan.nilsson_at_[hidden]]

Hi,

I'm using the Boost.Test (unit test framework) from cvs, trying to get xml
output redirected into files. The xml format itself is not a problem, but I
can't find any options to get the output into files.

Is this possible to do using either command-line arguments or environment
variables? It's possible, but awkard, to use unit_test_log::set_stream, but
I figured I'd check if there were any options before implementing that.

/ Johan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net