Menu

#62 Human-readable testcase names

open
nobody
runtest (3)
5
2012-02-05
2012-02-05
No

Feedback via mail:

It would be awesome if MoreUnit could produce human-readable testcase
names in Eclipse JUnit runner.

Say, I have FooTest class with some test methods:
shouldNotAllowEmptyStrings(), shouldProcessValidEntries() and
shouldReturnPositiveLength().

In the JUnit view the following is shown:

FooTest:
- shouldNotAllowEmptyStrings
- shouldProcessValidEntries
- shouldReturnPositiveLength

This is rather hard to read.

Borrowing the idea from http://agiledox.sourceforge.net/ , this could
be significantly improved (readability-wise):

FooTest:
- should not allow empty strings
- should process valid entries
- should return positive length

Looks *MUCH* better!

Currently, to achieve this result, I use my own custom Runner and just
rename testcase names there (I override testName() method). The
problem with this simple approach is that the test case becomes
non-clickable in the JUnit view, since JUnit plugin seems to be
expecting that test case name is a method name to look for and to jump
to. Naturally, it couldn't find a method named, e.g., "should return
positive length".

Hence, it seems, there is a need of dealing with it on plug-in level somehow.

Discussion

  • Vera Henneberger

    • assigned_to: ndemengel --> nobody
     
  • Vladimir Sizikov

    Here a small patch against Eclipse's org.eclipse.jdt.junit plugin sources. It adds a new toggle button (Human Readable Test Names).

    https://gist.github.com/1753844

    It satisfies my needs, but it would be much better to have something like that officially implemented (either in Eclipse proper or in some external plugins such as MoreUnit).

     

Log in to post a comment.