harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anton Avtamonov <anton.avtamo...@gmail.com>
Subject Re: [classlib] Unit and performance testing
Date Wed, 25 Jan 2006 10:04:56 GMT
On 1/25/06, Thorbjørn Ravn Andersen <thunderaxiom@gmail.com> wrote:
> Mikhail Loenko wrote:
>
> > fail() is not always convinient, for example, how would you print
> >
> >stack trace to fail()? Meanwhile stacktrace is most often enough
> >
> >
> If you need a stacktrace, why not just throw a RuntimeException at that
> point?  JUnit will then include the stack trace in the report.
>
> --
> Thorbjørn
>

Absolutely agree
As I know 'standard' test case signature is:

public void testSomeTestName() throws Exception {
}

So that all checked and runtime exceptions are passed directly to
JUnit framework (which properly logs them).

I do beleive logging is very useful feature. However I think that the
preferrable place to do logging is code rather than tests. JUnit
provides lots of fucntionality to write well-documented tests and we
don't have to add extra-code for logging (which obviously made test
cases longer and harder for understanding).

I beleive the right place to use logging are try/catch sections where
catch does nothing (the most ususal case), so that we just silently
ignore some error situations. Having logs there will allow us to
understand the system execution paths and what was going wrong and
where. For such purpose different logging levels work really fine.

--
Anton Avtamonov,
Intel Managed Runtime Division

Mime
View raw message