Boost logo

Boost :

From: Rozental, Gennadiy (gennadiy.rozental_at_[hidden])
Date: 2004-02-12 05:39:30


> 1. I need to have the test log and report written to two
> separate files in xml format. (It would be nice to have a DTD
> of both xml formats)

Ok. Will do. Will the schema work?

< I did this by instructing the framework
> with the command line argument: --output_format=XML. Now that
> I had both the log and result report in XML format I needed
> to create two file streams to redirect the output of them to
> each their own file. This was easy to achieve with the log
> using the set_log_stream method, but not so trivial with the
> result report. Calling the singleton of the result report
> before the test framework has initialized my code first calls
> a null pointer crashing the test. How should this be done?
> The documentation states that the interface of the
> unit_test_result does not need to be used directly, but in my
> case where I want a file stream instead of the std::err I
> need to have access to the singleton and preferable in the
> same place I set up the rest of my test suites.

First of all why would you need to do anything? By default log goes to
std::out and report goes to std::err. Also as you mentioned log output
stream could be reset using set_log_stream method. This should be enough for
your purposes
As for report output stream it's actually unit_test_main who is responsible
for setting specific stream and it not configurable at the moment.
 
> 2. To achieve pt 1 I needed to edit unit_test_framework.hpp
> (I think). I wanted to add support for my own command line
> argument which would instruct the framework of the two files
> I would like to create. So I thought it would be convenient
> to use the reteive_framework_parameter method to retrieve my
> custom command argument. Sadly enough I noticed that the
> method doesn't return the value assigned to my argument
> unless it is recognized. Is this fair?

Yes. This is true. reteive_framework_parameter only strips parameters from
command line that it knows about. The
rest you are getting in init function. You could use any method to retrieve
the value needed for you.
   Actually CLA support will be the first thing I am going to rework
completely for next release. I think it should address your concern either.
See mailing list for updates.
 
> Daniel R. Kåsa
>

Gennadiy.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk