Junit5: Test tree printer should not continue connection lines past terminal nodes

Created on 19 Feb 2017  ยท  10Comments  ยท  Source: junit-team/junit5

Overview

The tree printer continues hierarchy connection lines past terminal nodes as shown below:

โ”‚  โ”œโ”€ A stack
โ”‚  โ”‚  โ”œโ”€ is instantiated with new Stack() โœ”
โ”‚  โ”‚  โ”œโ”€ when new
โ”‚  โ”‚  โ”‚  โ”œโ”€ throws EmptyStackException when popped โœ”
โ”‚  โ”‚  โ”‚  โ”œโ”€ throws EmptyStackException when peeked โœ”
โ”‚  โ”‚  โ”‚  โ”œโ”€ is empty โœ”
โ”‚  โ”‚  โ”‚  โ”œโ”€ after pushing an element
โ”‚  โ”‚  โ”‚  โ”‚  โ”œโ”€ it is no longer empty โœ”
โ”‚  โ”‚  โ”‚  โ”‚  โ”œโ”€ returns the element when peeked but remains not empty โœ”
โ”‚  โ”‚  โ”‚  โ”‚  โ”œโ”€ returns the element when popped and is empty โœ”
  • (X) Bug report. It's conventional to use the lower-left corner character to indicate that a node is the last node in a particular level of the hierarchy.

Deliverables

  • [ ] Detect the last node in a given level of the hierarchy and use the lower-left corner character (extended ASCII 192 or the unicode equivalent) to discontinue the hierarchy's connection line as shown below:
โ”‚  โ”œโ”€ A stack
โ”‚  โ”‚  โ”œโ”€ is instantiated with new Stack() โœ”
โ”‚  โ”‚  โ””โ”€ when new
โ”‚  โ”‚      โ”œโ”€ throws EmptyStackException when popped โœ”
โ”‚  โ”‚      โ”œโ”€ throws EmptyStackException when peeked โœ”
โ”‚  โ”‚      โ”œโ”€ is empty โœ”
โ”‚  โ”‚      โ””โ”€ after pushing an element
โ”‚  โ”‚          โ”œโ”€ it is no longer empty โœ”
โ”‚  โ”‚          โ”œโ”€ returns the element when peeked but remains not empty โœ”
โ”‚  โ”‚          โ””โ”€ returns the element when popped and is empty โœ”
enhancement

Most helpful comment

All 10 comments

Will be implemented with the caveat that the tree is no longer printed immediately. The two other details modes, namely FLAT and VEROSE, will remain as-are.

@sormuras Looks nice!

Thanks for the thumbs.

What do you think of the aligned/grouped test report entry rendering: https://travis-ci.org/junit-team/junit5/jobs/207892944#L612 ?

@sormuras I like the way the test report's date is inset from the test name which implies another level of nesting in the hierarchy. In fact I think it's better without lines. There's one other possibility to include in your demo ... a test that has multiple single-line report entries (which could potentially have different timestamps).

I personally like aligning the separators when showing key/value data because it makes it more like a table but I wouldn't hold this issue up for that. Using even more indentation for the multi-value report entry shows that those items are all subordinate to the timestamp too. I think you've gone above and beyond the call of duty on the test tree printer!

[...] a test that has multiple single-line report entries (which could potentially have different timestamps).

Current (and outdated) iteration already covers that in a test. https://github.com/junit-team/junit5/compare/refactor_tree_printing_listener#diff-bcdd220ee20a4cdae2c4835d9e21e65bR163 May enhance the documentation demo as well.

I personally like aligning the separators when showing key/value data [...]

Me too. But having keys with different lengths will shuffle the lines around again.

Looks good!

Do you think an optional caption for a test report set is worth the effort? See https://github.com/junit-team/junit5/pull/711/files#r104756183

Probably not right now. Shall we create a separate issue?

M5 or 5.1. Fine with me. Created #712.

Was this page helpful?
0 / 5 - 0 ratings