cucumber / cucumber-jvm

Cucumber for the JVM
https://cucumber.io
MIT License
2.69k stars 2.02k forks source link

Register custom UrlReporter for Cucumber Reports #2324

Open aslakhellesoy opened 3 years ago

aslakhellesoy commented 3 years ago

Is your feature request related to a problem? Please describe.

I would like to capture the URL of the published report and send a message to an external service (Slack) with the URL of the report.

Describe the solution you'd like

I want to be able to specify an alternative implementation of UrlReporter, perhaps using a system property:

-Dcucumber.publish.urlreporter=com.acme.MyUrlReporter 

Work involved:

Describe alternatives you've considered

Redirecting STDERR to a file, then parse it with a shell script and send the message. That's quite a roundabout way of doing this.

Additional context

This is actually something that's requested by a user of Cucumber Reports.

mpkorstanje commented 3 years ago

I imagine you may be better of by making Cucumber reports a Slack app that makes the call backs. Similar to the Jira and Pagerduty Slack apps.

mpkorstanje commented 3 years ago

Okay. I am definitely convinced this isn't a good feature. Aside from being a nice example of feature creep, if the cucumber reports app were to make the calls to slack it would allow this functionality to work for all implementations rather then only cucumber-jvm.

aslakhellesoy commented 3 years ago

I wasn't suggesting implementing the slack logic - I only mentioned slack as an example. All I'm suggesting is to allow users to specify an implementation class of their own.

It could be used to send the result to a variety of destinations, depending on the users' needs. Some possible use cases:

The idea is to open up the API so users can capture the URL in their own team/environment/organisation specific way.

mpkorstanje commented 3 years ago

I'm aware. I don't think that is worth the complexity. Ideally we provide a plugin system such that these concerns are addressable by the end user. The current extension applies only to the PublishPlugin. And between a redesign, feature creep or alternative solution I reckon the alternative solution is the better way to support the example usecase.

mpkorstanje commented 3 years ago

See also: https://github.com/cucumber/cucumber-jvm/issues/1834

aslakhellesoy commented 3 years ago

I agree we should have a uniform plugin solution rather than many different ones sprinkled across the codebase.

Are you saying that if we implement #1834 we might be able to support a pluggable UrlReporter too?

mpkorstanje commented 3 years ago

No but the publish plugin would have it's own module and it's own api. Part of that API could be a client to talk to the reports api.

People with different use cases could reuse that client in their own plugin. And then for example compose their slack notifier around it.

The biggest challenge is accessing configuration for plugins and url reporters. With a better plugin system we can make that easier. Instead of providing a single purpose extension point by enabling composition we can facilitate much more.

ahmetchakmak commented 2 years ago

I am very surprised this feature is not implemented already. Clicking on a console output shouldn't be the only way to reach report. There is basically no way to share report link with others with your automation code.

mpkorstanje commented 2 years ago

Cucumber is an opensource project and mostly maintained by people in their spare time. Are you interested in doing the work needed to make the plugin system more pluggable?

aslakhellesoy commented 2 years ago

Also see the last paragraph of the LICENSE. If you really want this you can contribute it yourself. We're here to help you if you have any questions about how to proceed.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two months if no further activity occurs.