harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr <g...@pobox.com>
Subject Re: [classlib] millions of rmi tests
Date Tue, 30 May 2006 12:38:19 GMT


Mikhail Loenko wrote:
> I've tried to integrate rmi2 tests to rmi module,  and found some odd 
> things.
> 
> Let's take a look for example at TestActivationGroupDesc.java
> 
> it has 5158 test methods, most of which are very similar.
> For example it has 855 tests that invoke constructor with various 
> parameters
> and check that new did not return null and no exception was thrown:

Can 'new' actually return null?  My read of the JLS says that it won't.


> 
> Compare
> 
> public void 
> testActivationGroupDescStringStringMarshalledObjectPropertiesCommandEnvironment006()

> 
> {
> 
>    try{
>        Properties p= new Properties();
>        assertNotNull(msgNotNull, new ActivationGroupDesc(null ,  null ,
>                new MarshalledObject(new Double(23.4))  ,  new 
> Properties() ,
>                new ActivationGroupDesc.CommandEnvironment("Hola la",
>                new String[0])));
>    } catch (Throwable e) {
>        fail(msgNoException+e);
>    }
> }
> 
> and
> 
> public void 
> testActivationGroupDescStringStringMarshalledObjectPropertiesCommandEnvironment007()

> 
> {
>    try{
>        Properties p= new Properties();
>        assertNotNull(msgNotNull, new ActivationGroupDesc(null , null ,
>                new MarshalledObject(new Double(23.4))  ,  new 
> Properties() ,
>                new ActivationGroupDesc.CommandEnvironment("", null)));
>    } catch (Throwable e) {
>        fail(msgNoException+e);
>    }
> }
> 
> 
> This is how the constructor under test looks like:
> public ActivationGroupDesc(String className, String codebase,
>        MarshalledObject data, Properties props,
>        ActivationGroupDesc.CommandEnvironment env) {
> 
>    this.className = className;
>    this.location = codebase;
>    this.data = data;
>    this.props = props;
>    this.env = env;
> }
> 
> It seems that instead of those million test cases we need just a few
> that would verify that getXXX() methods return what was passed into 
> constructor
> plus possibly some tests that pass 'suspicious' parameters like null.
> 
> Thoughts?

I don't agree that would be enough - having tests that assualt the CTORs 
w/ combinations of crap to see what happens isn't a bad thing.  Not a 
fun thing to write, but certainly not something I vote on throwing away 
if someone wrote it already.

Why do you see a problem?

I think that it's misleading to trust only that getters return what's 
passed in...

geir



---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message