Skip to content

"Description" should freely allow test names containing "(" and ")". #327

Open
@aknrdureegaesr

Description

@aknrdureegaesr

The sad story

Like many other people, I have my own naming requirements for parametrized tests. I call my tests “data driven”. My test method names are a low level test implementation detail, not helpful to differentiate individual tests.

I solved my naming needs through a patched version of the Parameterized class and its TestClassRunnerForParameters inner class. This worked quite nicely at first. Until “(” and “)” appeared in the names of my tests.

As I found out the hard way, class Description has logic about what “(” and “)” mean in a test name. The assumptions made by that class are just plain wrong in my case. Also not good, the constructor of Description is private. So to get what I want, I cannot resolve to the usual "derive and change judiciously".

My request:

The present Javadoc promises:

Descriptions ... are entirely informational. They contain no logic aside from counting their tests.”

In view of that Javadoc, the present Description code is buggy.

Please make good on that promise. In my opinion, Descriptions should provide access to some strings that meaningfully identify the particular test or test suite to the end user - with no logic attached to those strings.

Please remove all assumptions from the code that description strings can be parsed to make available class and/or method names.

Workaround

I replace “(” to “[” and “)” to "]” .

(I will present these tests to a meeting of developers in a few weeks time, and those names will look ugly .)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions