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

Greg Sheremeta gshereme at redhat.com
Wed Dec 9 16:56:08 UTC 2015


On Mon, Dec 7, 2015 at 2:00 PM, Vojtech Szocs <vszocs at redhat.com> wrote:
> 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?

+1.

Use the underscores!

We worry way too much about checkstyle. Huge time waster, IMHO. But,
I'm so over Java, so that may just be me. Bring on the JavaScript!

Greg


>
> Regards,
> Vojtech
> _______________________________________________
> Devel mailing list
> Devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/devel



-- 
Greg Sheremeta, MBA
Red Hat, Inc.
Sr. Software Engineer
gshereme at redhat.com



More information about the Devel mailing list