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

Vojtech Szocs vszocs at redhat.com
Mon Dec 7 19:00:36 UTC 2015


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



More information about the Devel mailing list