multiple formatters/reporters with access to CucumberOptions

27 views
Skip to first unread message

Vaclav Stengl

unread,
Sep 25, 2016, 6:11:56 PM9/25/16
to Cukes
Hello,

i am writing cucumber reports plugi for Cucumber framework tests run by Jenkins and web app to present reports and various statistics. I have already created my own class impl Formatter and Reporter interface. But our company needs to use also json formatter. So i need to use 2 or more formatter/reporter at once.
It could be solved like this plugin = {"json:target/result.json", "xxx.xx.CustomCucumberFormatter"} but i need to propagate glue to my Formatter/Reporter (because of statistics purposes feature run with different glue is counted only once but for reports its multiple feature runs). 

So I got some ideas how to solve it, but for different reasons i cant do it:
1, Rewrite cucumber.runtime.junit.JUnitReporter class so its constructor will take List<Formatter> and List<Reporter> and call all of them for interface method - I can't do it, because in this class is called class with package protected method (ExecutionUnitRunner.describeChild(runnerStep)). (There will also need to rewrite Cucumber runner so it will add my Formatter/Runner instance to other). 

2, Use Formatter constructor - dunno how to propagate CucumberOptions to formatter (there are supported URL, File, String classes). 


I also need Reporter and Formatter to be only one instance! It holds some inner state.

Is there any solution for this problem?

Thx for answer,

V

Vaclav Stengl

unread,
Sep 26, 2016, 2:10:15 PM9/26/16
to Cukes
Reply all
Reply to author
Forward
0 new messages