consistent naming for tests

Andy Goryachev andy.goryachev at oracle.com
Tue Jul 9 14:52:12 UTC 2024


+1 for comments, links to the JS tickets, and descriptive names.

Speaking of the test names, I wanted to bring up an issue that I've encountered recently which concerns the use of @Nested -
https://bugs.openjdk.org/browse/JDK-8334497

Two test files consistently generate an error in Eclipse
- ObservableValueFluentBindingsTest
- LazyObjectBindingTest

I admit I have a weird setup (EncFS on Linux Mint running on MacBook Pro), and it only manifests itself in Eclipse and not in the gradle build - perhaps Eclipse actually verifies the removal of files?

Anyway, a suggestion - if you use @Nested, please keep the class names short.

Thank you
-andy





From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of Johan Vos <johan.vos at gluonhq.com>
Date: Tuesday, July 9, 2024 at 02:33
To: openjfx-dev <openjfx-dev at openjdk.org>
Subject: consistent naming for tests
Hi,

An interesting question from John Hendrikx (https://github.com/openjdk/jfx/pull/1283/#discussion_r1637684395) probably needs some general discussion on this list.
Afaik, we don't have guidelines for how to name tests (in https://github.com/openjdk/jfx/blob/master/CONTRIBUTING.md#coding-style-and-testing-guidelines)

In the different test files we have, I see different patterns:
* in some cases, tests are always prefixed with `test` (e.g. `testFoo()`)
* in some cases, tests have a concise but somehow meaningful name (e.g. `testScrollBarStaysVisible`)
* in some cases, tests refer to JBS issues (e.g. testJDK8309935)
* in some cases, the test is explained in comments.

I think it would be good to have some consistency going forward. (I'm not advocating we need to rename existing tests!)
I don't have a strong preference myself, but I think the link to the JBS issue that triggered the creation of a specific test is always good to have. I am also very ok with comments, but I learned not everyone likes that.

Thoughts?

- Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20240709/60f26b4b/attachment.htm>


More information about the openjfx-dev mailing list