4 Feb 2005 08:20
Re: [groovy-dev] avoid println in tests ?
Good idea; fancy having a go :) For Groovy tests we derive from GroovyTestCase and println will use the 'out' property to write to; so we could just set that to be a StringWriter maybe? On 3 Feb 2005, at 20:41, Bruce Chapman wrote: > A Crazy idea. > > Hack the test framework so... > > Before each test, set System.out to be a new PrintWriter(new > CharArrayWriter()) > > IF the test passes, discard the System.out stuff > > IF the test fails, then send the CharArrayWriter buffer to the regular > System.out. (and thence to the reports) > > > Result: No printlns muddying the test report, EXCEPT for the tests > that fail > (in which case printlns might actually be useful to someone) > > Bruce > > -----Original Message----- > From: Dierk Koenig [mailto:dierk.koenig@...] > Sent: Thursday, 3 February 2005 11:22 p.m. > To: dev@... > Subject: RE: [groovy-dev] avoid println in tests ? > > they are already rerouted to the test-report files, > which essentially means, the mess is somewhere else> > sure, it would help a little, to separate at least > the system.outs of the framework from those of the > tests. (not sure, how to achieve this) > >> -----Original Message----- >> From: jastrachan@... [mailto:jastrachan@...] >> Sent: Mittwoch, 2. Februar 2005 19:33 >> To: dev@... >> Subject: Re: [groovy-dev] avoid println in tests ? >> >> >> Could we maybe pipe the output of println to somewhere else, so you >> can >> see the test report with what worked/didn't and not have to wade >> through the output? >> >> >> On 2 Feb 2005, at 18:27, Dierk Koenig wrote: >>> Hiall, >>> >>> browsing through the current test suite and using the >>> test reports I noticed that there are numerous >>> println statements. >>> Those printlines make the reports more difficult to read >>> than they should be. >>> They also do not add much to the expressiveness of the >>> tests as they do not reveal what is expected. >>> >>> I'd like to propose the general rule to avoid >>> output to System.out in test cases. >>> >>> The current changes we need to apply to the >>> existing test suite may offer the opportunity >>> to get rid of this "test smell". >>> >>> Any comments? >>> >>> Mittie >>> >>> >> >> James >> ------- >> http://radio.weblogs.com/0112098/ >> > > > > James ------- http://radio.weblogs.com/0112098/
>
> sure, it would help a little, to separate at least
> the system.outs of the framework from those of the
> tests. (not sure, how to achieve this)
>
>> -----Original Message-----
>> From:
RSS Feed