reportportal / agent-js-cucumber

Agent to integrate CucumberJS with ReportPortal.
https://www.npmjs.com/package/@reportportal/agent-js-cucumber
Apache License 2.0
12 stars 17 forks source link

cannot use report portal formatter with other cucumber formatters #137

Closed OffirLandau closed 1 year ago

OffirLandau commented 1 year ago

I am using the reportPortalFormatter in my cucumber command: cucumber-js -f ./reportPortalFormatter.js

As expected I can see my test results in report-portal. However, I want to use another formatter to see my tests results in my local logs as well. Usually I use: cucumber-js -f 'progress' to see which tests passed and which failed in my console.

When trying to combine the two: cucumber-js -f 'progress' -f ./reportPortalFormatter.js

one formatter overrides the other, so that only the last formatter is activated. Is there a way to use reportPortalFormatter alongside other formatters?

PriyankaSoni1210 commented 1 year ago

Hi Team, We are facing the same issue. This looks like a design flaw where we can only use either the report portal formatter or the cucumber-js formatters like html reporting, json report, cucumber pretty formatter etc. For our project we also require XRAY, for which we need cucumber json report but right now it is either cucumber html/json report or report portal launches. Are there any plans to accommodate the default formatters?

AmsterGet commented 1 year ago

@Bam6ycha could you please take a look?

Bam6ycha commented 1 year ago

I will try to figure it out as soon as I can!

Bam6ycha commented 1 year ago

@PriyankaSoni1210, @OffirLandau Hi there! According to cucumber-js documentation: if you specified several formatters with the same output, only the last will be apply. If you want to use several formatters at the same time, you need to specify the output file for each formatter separately. F.e. : module.exports = { default: `--format-options '{"snippetInterface": "synchronous"}' -f ./report-portal-formatter.js -f html:report.html -f json:report.json, }; In the above code snippet,the PR formatter will write into stdout,the html formatter will write into the report.html file, the json formatter into report.json file. You don't need to create these files, formatter will automatically create them for you. To get more information, follow the links https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md (formatters), https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#options (cucumber CLI). I hope these instructions will help you!

PriyankaSoni1210 commented 1 year ago

@Bam6ycha Thanks, this was really helpful, it works as expected!! :)

AmsterGet commented 1 year ago

@OffirLandau @PriyankaSoni1210 Hello guys, can we close this issue?

PriyankaSoni1210 commented 1 year ago

Hi @AmsterGet , It works with the solution @Bam6ycha proposed, so the issue can be closed!!! Many thanks for the help!! :)