[ovirt-devel] Question about https://gerrit.ovirt.org/#/c/49860/

Allon Mureinik amureini at redhat.com
Thu Dec 10 16:22:59 UTC 2015


Adding devel list, which was dropped by mistake.

On Thu, Dec 10, 2015 at 1:56 PM, Allon Mureinik <amureini at redhat.com> wrote:

>
>
> On Wed, Dec 9, 2015 at 6:51 PM, Vojtech Szocs <vszocs at redhat.com> wrote:
>
>> Hi Allon,
>>
>> not sure if you saw my email (below) but I was wondering
>> what's your opinion about test method naming conventions.
>>
> ​Generally agree with that, and I tried excluding them where possible - if
> I missed any, please say so.
>>
>
>>
>> Also, regarding patch https://gerrit.ovirt.org/#/c/49910/
>> why not simply exclude all Java files under src/test/java
>> for all projects? (What's the advantage of having per-file
>> exclude list of test classes?)
>>
> ​I hat overly-broad exclusions.
> There are a ton of badly named method in test classes, and I don't want to
> encourage any more.
> Although if you think this is getting out of hand, we could just do that...
>>
>
>>
>> To address other files, like "Other GWT-related classes"
>> in [1] -- did you consider adding some source-level Java
>> annotation like @DontCheckMethodNames or similar? (Again,
>> avoid per-file exclude list of other classes.)
>>
> ​Yeah, but I don't want to have to write my own checker - this is a
> standard checkstyle check...
>
>
>>
>> [1]
>> https://gerrit.ovirt.org/#/c/49910/4/build-tools-root/checkstyles/src/main/resources/checkstyle-suppressions.xml
>>
>> Thanks,
>> Vojtech
>>
>>
>> ----- Forwarded Message -----
>> From: "Vojtech Szocs" <vszocs at redhat.com>
>> To: "devel" <devel at ovirt.org>
>> Sent: Monday, December 7, 2015 8:00:36 PM
>> Subject: [ovirt-devel] Question about https://gerrit.ovirt.org/#/c/49860/
>>
>> Hi Allon!
>>
>> patch in $subject modifies test method name from:
>>
>>   testGetLocaleFromStringString_withDefault
>>
>> to:
>>
>>   testGetLocaleFromStringStringWithDefault
>>
>> I've always thought that Java test method names should be
>> as much readable as possible, because in Java tests, the
>> method name is used to describe the particular test case.
>>
>> (Unfortunately, Java test frameworks don't do a good job
>> in this area.. please correct me if I'm wrong.)
>>
>> So with JS/Jasmine we can do this:
>>
>>  describe('LocaleUtils', function () {
>>    it('should extract locale from given String', function () {
>>      // actual test code
>>    });
>>  });
>>
>> but in Java we usually do this:
>>
>>   // <methodName>_<extraInfoForSpecificTestCase>
>>   void testGetLocaleFromStringString_withDefault
>>
>> which is already far from readable, and this:
>>
>>   testGetLocaleFromStringStringWithDefault
>>
>> makes it even worse.. Even though it complies with Java
>> method naming convention, it totally obfuscates what is
>> that particular test case about, which means people who
>> want to maintain such tests need to spend time studying
>> what the test is actually doing..
>>
>> What's your take on this?
>>
>> Regards,
>> Vojtech
>> _______________________________________________
>> Devel mailing list
>> Devel at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/devel
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20151210/5bd7a639/attachment-0001.html>


More information about the Devel mailing list