Skip to content

Clarification on test method naming rules in Section 5.2.3 #1315

@vivek-0509

Description

@vivek-0509

In Section 5.2.3 Method Names, the style guide states:

"Underscores may appear in JUnit test method names to separate logical components of the name, with each component written in lowerCamelCase, for example transferMoney_deductsFromSource."

Case that needs clarification:

Single-word components in test method names

@Test void test_foo() {}
@Test void testing_name() {}

The style guide states that underscore-separated components must be written in lowerCamelCase, but it does not clarify whether a single-word identifier (e.g. foo, name) qualifies as acceptable lowerCamelCase in this context, or whether each component is expected to consist of multiple camel-case words.

Clarification requested

Should each underscore-separated component in JUnit test method names:

  • Be allowed to be any valid lowerCamelCase identifier, including single-word names like foo or name (e.g. testing_foo), or
  • Require every component to consist of multiple lowerCamelCase words (e.g. transferMoney_deductsFromSource), or
  • Require only the segments after underscores to be proper multi-word lowerCamelCase (e.g. test_deductsFromSource where test is single-word but deductsFromSource is multi-word)

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions