On Wed, Dec 9, 2015 at 6:51 PM, Vojtech Szocs <vszocs@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@redhat.com>
To: "devel" <devel@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@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel