harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang" <zhanghuang...@gmail.com>
Subject Re: Long,long testcase name...
Date Wed, 12 Apr 2006 12:56:51 GMT
Hello, geir,
Let's consider the case you mentioned.
I totally agree that "testRequestPasswordAuthentication1" is a BAD name,
but I don't think
"test_requestPasswordAuthentication_java_lang_String_java_net_InetAddress_int_java_lang_String_java_lang_String_java_lang_String_java_net_URL_java_net_Authenticator_RequestorType()"
is a very GOOD name.

Could we make any possible compromise between these two extreme naming
convention in such case ? e.g. use simple class name instead of full class
name. IMO, "test_requestPasswordAuthentica
tion_String_InetAddress_I_String_String_String_URL_RequestorType" looks a
bit clearer than a full screen name, and is also more meaningful than
"testRequestPasswordAuthentication1".

There's another concern about current test case naming convention. When the
input/output of the method is complex, test case for this method will be
very long. For example, for someAPI, I have to verify the behaviour when the
input argument is null, and some other values, and also have to test the
output when a security manager is enabled and disabled. IMHO, use serveral
little test_argumentlist_situationdescription testcase will be a little
clear both for developers and testers.

Anyway, I know it's hard to say which naming convention is better. The great
benifit of naming convention is that all developers will follow the same
way, which is far more important than the rules of naming convention.


--
Andrew Zhang
China Software Development Lab, IBM


On 4/12/06, Geir Magnusson Jr <geir@pobox.com> wrote:

>
>
> public void testRequestPasswordAuthentication1()
>        throws Exception
> {
>       ...
>        Authenticator.requestPasswordAuthentication( rHost, rAddr,
>                rPort, rProtocol, rPrompt, rScheme, rURL, reqType);
>
>       ...
> }
>
> public void testRquestPasswordAuthentication2()
>        throws Exception
> {
>       ...
>        Authenticator.requestPasswordAuthentication(rURL, reqType);
>       ...
> }
>
> versus
>
> package org.apache.harmony.luni;
>
> public void
>
> test_requestPasswordAuthentication_java_lang_String_java_net_InetAddress_int_java_lang_String_java_lang_String_java_lang_String_java_net_URL_java_net_Authenticator_RequestorType()
>
>        throws Exception
> {
>       ...
>        Authenticator.requestPasswordAuthentication( rHost, rAddr,
>                rPort, rProtocol, rPrompt, rScheme, rURL, reqType);
>
>       ...
> }
>
> public void
>
> test_requestPasswordAuthentication_java_net_URL_java_net_Authenticator_RequestorType()
>
>        throws Exception
> {
>       ...
>        Authenticator.requestPasswordAuthentication(rURL, reqType);
>       ...
> }
>
> Practically speaking, what does the multi-screen-name do for you that
> looking at a simple method name and signature doesn't?
>
> I mean, you aren't going to be searching by the full string - you'd
> never type
>
>
> test_requestPasswordAuthentication_java_lang_String_java_net_InetAddress_int_java_lang_String_java_lang_String_java_lang_String_java_net_URL_java_net_Authenticator_RequestorType()
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message