harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [classlib] Unit and performance testing
Date Wed, 25 Jan 2006 12:10:16 GMT
Mikhail Loenko wrote:
> One more reason when logs are necessary:
> 
> If testing is possible in some configurations only
> (like set of providers contains something or default encoding is ...), then
> 1) build failing in all different configs would be annoying

huh? if you can determine that the test is bogus in a given
configuration, then simply skip the test.  Logging the 'expected'
failure is no help (who's going to read it?!) and if you don't know the
failure is expected then you have much bigger problems.

> 2) One has to be able to scan logs for warnings to verify that
> functionality is tested
> when the config is as expected

No, please, just let the tests pass if they are expected to pass.  We
don't need to log conditionals to prove they were taken -- just write
the tests properly.

Regards,
Tim

> A different exit status for the tests that can test in the given
> configuration would
> help.
> 
> Thanks,
> Mikhail
> 
> On 1/25/06, Anton Avtamonov <anton.avtamonov@gmail.com> wrote:
>> 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
>>
> 

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

Mime
View raw message