Re: [Cppunit-devel] TODO Documentation
Brought to you by:
blep
From: Baptiste L. <gai...@fr...> - 2002-03-27 15:40:30
|
----- Original Message ----- From: "Robert Wenner" <ro...@po...> To: "Baptiste Lepilleur" <gai...@fr...> Cc: <cpp...@li...> Sent: Wednesday, March 27, 2002 4:03 PM Subject: Re: [Cppunit-devel] TODO Documentation > On Wed, Mar 27, 2002 at 03:25:07PM +0100, Baptiste Lepilleur wrote: > > Can you look at http://gaiacrtn.free.fr/cppunit/index.html and let me know > > if you find the GUI and the creatin test case/ways of macros description > > clear enough ? (they need update but the basic haven't changed since then). > > I remember I had a look at that page, but quickly turned away because > its release number was smaller than that I got (1.5.5 compared to > 1.6.2) and it seemed to contain almost only MS Win stuff. Yes, though it's where all the macros and stuff come from. > > >From what I read below, it's seems that you are indeed refering to > > TestResultCollector (TestResult have been splitted in two classes since > > 1.7.3). > I have problems seeing where to get my own hooks in. > For example: I got some test that may crash the program (segmentation > fault). Thus the TextTestRunner displaying only dots and F or E > does not suffice, I want the name of each test before it is > started and the ok or e or f and the failure information when it > finishes. With that I would see which test crashes the program > (I don't want to rely on counting the dots and counting the > test methods.) What you want is a custom TextTestProgressListener. At the current time it's hardcoded, but I'll add some methods (like setOutputer) to allow simple customization. > Now I wrote my own TestListener, but can not find where to get it > in. TestCase does not define defaultResult to be virtual so I > can not override it to return a TestResult to which I added > my Listener. defaultResult() is not used. It is a leftover of the port from Java. What you need to change is: bool TextTestRunner::runTest( Test *test ) { TextTestProgressListener progress; // <<<< m_eventManager->addListener( &progress ); test->run( m_eventManager ); m_eventManager->removeListener( &progress ); return m_result->wasSuccessful(); } On the way, I'll also make those protected methods virtual... > Also confusing: TextTestRunner and the UI Test Runners don't inherit > from TestRunner? What is TestRunner ? > > I'm thinking of renaming TestResult to TestController. It's managing the > > TestListener, and in the short future, it'll provide a way to > > protected/decorate and test (for timing, COM initialization, and specific > > exception capture). Would that help ? > That is one thing, but more important would be IMHO some 3 to 5 > sentences in a brief description what the class is used for. And a hint > on what to customize here. This brief description should not copy > the information already given in the generated documentation. > For TestListener it could be something like this: > "Implementing the Observer pattern a TestListener may be registered > to a TestResult to obtain information on the testing progress. Use > specialized sub classes of TestListener for text output > (TextTestProgressListener). Do not use the Listener for the test > result output, use a subclass of Outputter instead." Sound good. Mind if I copy that ? > Or for the TestResult: "Traverses the test cases in given suits. > This class shouldn't have to be inherited from. Use a TestListener > or one of its subclasses to be informed of the ongoing tests. > Use a Outputter to receive a test summary once it has finished." Good, though TestResult does not actually traverse, it's TestSuite. > [Correct me if I wrong, but you get the idea.] Yups. > > There is a CPPUNIT_FAIL, name CPPUNIT_FAIL (amasing, isn't it ?) ;-) > Ah, thanks, I really missed that one. :-) > Maybe move the descriptions from the NEWS file to the official > documentation, after removing references to the previous release > of cppunit? Do you means having something like: CppUnit Features: ------------------ * Assertion: CPPUNIT_ASSERT CPPUNIT_FAIL ... * Composing TestFixture: CPPUNIT_TEST_SUITE CPPUNIT_TEST_EXCEPTION ... * GUI: MfcTestRunner QtTestRuner TextTestRuner ... Well, you get the idea. Baptiste. |