I generally like descriptive names for test methods (and classes) rather than encoding the bug ID in the name. A comment with the bug ID is very helpful, and I would support making that a best practice. If the purpose of a test is non-obvious, a comment explaining it is a good idea.

-- Kevin

On 7/9/2024 2:33 AM, Johan Vos wrote:
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

Reply via email to