Skip to content
This repository

Add system properties to allow alternate velocity templates #30

kunal546 opened this Issue · 2 comments

3 participants

kunal546 outofrange Dan Dyer

This is an enhancement request.

The reporter is awesome. There is a way already to override the css.
Is it possible to allow for alternate velocity templates? Like be able to use custom results.html.vm.
I understand that it's an implementation detail which may change.

My original requirement - Sometimes there is a lot of test data against which the test methods are executed. Within the test result groups (Failed, Skipped and Passed), I want to be able to first see the test method names (JUnit style) i.e. report grouped by test method name which is expandable to see all the details of each execution.

For e.g.

If methods testA, testB and testC ran 1000 times each, then

instead of seeing

... (300 times)
... (200 times)
... (350 times)

...(700 times)
...(800 times)
....(650 times)

I would like to see


testA (collapsed)
testB (collapsed)
testC (collapsed)

same as above

and be able to expand the lists to see executions.

I understand that there may be many more such custom needs but at the same time we would like to be able to use the powerful HTMLReporter component. So it may be good to allow overriding the templates.



Dan Dyer

This is definitely a good idea. It is probably possible already without any changes. ReportNG loads its templates from the classpath, so if you create a directory or a JAR file with your own versions of the templates and put this on the classpath ahead of the ReportNG JAR, it should load your templates rather than its own.

The templates are quite tightly coupled to the Java code, so you'd have to maintain the same basic structure but you should be able to add to them reasonably freely.

You'd need to take a copy of the current templates as a starting point and make sure that they use the same names and are in the same directory/package as the current ones (i.e. org/uncommons/reportng/templates/html/).

If you want a more flexible/user friendly mechanism for specifying alternative templates, I'm open to adding that. As you can probably tell from my pathetically slow response, I don't spend much time looking at this project, so I'll make no promises about adding it any time soon but I'll consider any pull request along these lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.