|
Boost Users : |
From: eli_at_[hidden]
Date: 2004-01-25 17:19:19
class TestFixtureA { MyA myA; TestFixtureA(...) : myA(...){ } void testMethod1() { perturbWithMethod1(myA); BOOST_CHECK(somethingAbout(myA)); } void testMethod2() { perturbWithMethod2(myA); BOOST_CHECK(somethingElseAbout(myA); } };The results of testMethod2 are context sensitive: if you include testMethod1 and testMethod2 in your suite, the results of testMethod2 can be different than if testMethod2 were called alone. This seems to take the unit out of unit testing, and the fix out of fixture. In other frameworks, the behavior is that setUp() will be called independently for each invocation of each test method. This is possibly resource intensive, but makes for very atomic testing and I think it is essential to the unit testing concept.
setUp(); shared_ptr<void> guard(static_cast<void*>(0), bind(&Class::tearDown, this));and calling this function from every other single test function. This is a pain to do manually, and introduces human error issues. Dean included a second suggestion as to how to make it part of the framework.
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