cucumber / cucumber-js

Cucumber for JavaScript
https://cucumber.io
MIT License
5.02k stars 1.09k forks source link

Can we have attachment class properties accessible from ITestStepHookParameter #2320

Closed mrsenzy closed 11 months ago

mrsenzy commented 11 months ago

🤔 What's the problem you're trying to solve?

I am building a custom real time report by capturing all events occuring at after step and after scenario hooks. I captured all information except the step log which user adds for each step definition for e.g this.attach("I am logged). I am unable to capture these details at after hooks

✨ What's your proposed solution?

Can we add Attachment class properties to be accessible from ITestStepHookParameter interface

⛏ Have you considered any alternatives or workarounds?

Currently team is using third party reporting tools like cucumber-html-reporter but we are trying to minimize the third party dependency and have in house reporting tool enabled for maintenance and custom enhancements on organization needs.

📚 Any additional context?

image image


This text was originally generated from a template, then edited by hand. You can modify the template here.

davidjgoss commented 11 months ago

The way to access things like attachments, especially for a reporting use case, is to write a formatter.

That said, if you really want to get at attachments in an After hook, consider implementing a custom world class where you can provide your own attach method that wraps the normal one and adds to an array that you can access from the hook later.