Junit5: Add CamelCase Display Name Generator

Created on 23 Sep 2018  路  15Comments  路  Source: junit-team/junit5

Overview

As a follow-up from #1588 use the DisplayNameGenerator SPI to turn names of test classes and test methods using camel-case notation into human-readable display names.

Related Issues

  • #1596

Deliverables

  • [ ] Create and implement CamelCaseGenerator in org.junit.jupiter.api.DisplayNameGenerator
  • [ ] Integrate this new pre-defined generator into org.junit.jupiter.engine.descriptor.DisplayNameUtils
  • [ ] Extend org.junit.jupiter.api.DisplayNameGenerationTests to verify the implementation
Jupiter reporting new feature

Most helpful comment

Sure, that sounds like a good idea!

All 15 comments

@sormuras are there anyone already working on this issue? I can work on it.

Hi @andreybleme sure -- but wait until #1588 was merged to master. There might be changes in the API/SPI incoming.

@sormuras ok I'm waiting for it. Thanks.

Ready, set... Go!

The Display Name Generator SPI is now available.

Seems that @zoltanersek already did it. I'll move to another issue.

is this wrapped up? Can we remove the "up for grabs" label, if so?

Before implementing such a generator, we should come up with a table of example method names and agree on what the generated display names should be. Thus, I've changed the status to _blocked_ for the time being.

Hi, @marcphilipp I would like to take a step on this, I can make a table with examples for team discussion and clarification on how this should be displayed, in order to remove the blocker and finish if there are missing modifications, sounds good?

@Kazhuru Sure, that sounds good! 馃憤

| Method/Class Original Names | Generated Display Name |
| ------------- | ------------- |
| MyFirstJunitJupiterTests() | My First Junit Jupiter Tests |
| testWithDisplayNameWithEmojis() | test With Display Name With Emojis |
| MyFirstJunitJupiterTests() | My First Junit Jupiter Tests |

Hi there, I would like to propose this kind of output activity for this generator:

| Method/Class test name input | Display name generator output |
| ------------- | ------------- |
| MyFirstJunitJupiterTests() | My First Junit Jupiter Tests |
| JunitTestNumber12OfToday() | Junit Test Number 12 Of Today |
| timeoutNotExceededTest() | timeout Not Exceeded Test |
| ThrowsNullPointerException() | Throws Null Pointer Exception |
| test1() | test 1|
| underscore_test_here() | underscore_test_here |
| testingastack() | testingastack |
| OddSymbols#%-Method() | Odd Symbols#%- Method |

I dont' know if we could aggregate more scenarios or this is a good output?

Couldn't this be at least integrated into https://github.com/junit-pioneer/junit-pioneer in form that @Kazhuru suggested instead of being still blocked after 7 months :/?

Sure, that sounds like a good idea!

Team decision: Since there are so many edge cases we feel that it might be not be feasible to implement an out-of-the-box general purpose camel case generator that meets the majority of users' needs. Thus, we close this issue for now. If you need one, the API is extensible by design and you can write your own.

Was this page helpful?
0 / 5 - 0 ratings