Boost logo

Boost Users :

Subject: Re: [Boost-users] [test] boost::test equivalent of CppUnit's "protectors" ?
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2009-05-12 13:28:05


Tim Day <timday <at> bottlenose.demon.co.uk> writes:

> > > BOOST_FIXTURE_TEST_CASE maybe comes closest. (However, whereas a
> > > CppUnit protector can return a bool to indicate pass/fail, it's less
> > > clear to me how a fixture destructor should indicate failure).
> >
> > What and where you want to indicate? How framework has to respond to this
> > indication?
>
> I was just concerned that if I went down the route of trying to indicate
> test(-suite) failure from BOOST_FIXTURE_TEST_CASE's destructor, pretty
> much the only option would seem to be be to throw (not a nice thing to
> do in a destructor)

Yes. I think that you can do this. If you test stack unrolling using
uncaught_exception().

> closely). But failing a test within a test_observer::test_finish() call
> seems like it ought to be a cleaner place to do it.

It was not designed for this purpose. Maybe we can reconsider it.

Gennadiy


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