Re: [Cppunit-devel] Custom progress with TextTestRunner
Brought to you by:
blep
|
From: Robert W. <ro...@po...> - 2002-03-28 10:25:16
|
On Wed, Mar 27, 2002 at 05:41:54PM +0100, Baptiste Lepilleur wrote: > Hum, actually you can already do that (forgot that I exposed the > eventManager to do that): > CppUnit::TextTestRunner runner; > runner.addTest( CppUnitTest::suite() ); // Add the top suite to the test > runner > runner.eventManager().addListener( &myProgress ); // your progress > indicator > > runner.run(...) > > => the TextTestProgressListener would still be used, but called your > listener (since it was registered first). I'll just add an option to make it > optional. > Unfortunately this does not work as expected. Adding my own listener as described above results in mixed output from my listener and TextTestProgressListener as in bool CppUnit::TextTestRunner::runTest(Test *test) with each call to this method a new TextTestProgressListener is created, added to the list of listeners and after the test removed. :-( No way to avoid this without modifying the source. Why is it done this way? Isn't that a somewhat tight coupling between the TestRunner and one of its Listeners? Isn't TextTestRunner actually a misnomer? IMHO there should be exactly one kind of TestRunner but it would be independent of Text, GUI or whatever and its Listeners and ResultCollectors would take care of displaying and such. Robert |