Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve report so that pending and undefined steps do not show scenarios and features as failed #636

Closed
wants to merge 13 commits into from

Conversation

SteveDonie
Copy link

I had expected that when a scenario has pending or undefined steps, that the scenario as whole would also have the status 'undefined' or 'pending', but currently it shows these scenarios and the features they are in as 'failed'. The changes in this pull request implement that functionality for the main reports. The trend reports have not yet been improved to understand the concent of scenarios or features that are undefined or pending.

I came to this decision after looking at the other cucumber reporting tools, including the command line and the built-in html formatters.

The command-line reporting reports scenarios as failed, passed, undefined, or pending:

Failing Scenarios:
cucumber -p linux features/auditdb_and_reporting_mssql.feature:110 # Scenario: Verify a hammer insertSavedAuditData operation repeated, discrete H2 updates PROJECTS with exactly one row in MSSQL AuditDB (DVONE-4163)

3 scenarios (1 failed, 1 undefined, 1 passed)
171 steps (1 failed, 92 skipped, 1 undefined, 77 passed)
1m3.148s

Or in this case:

1 scenario (1 pending)
29 steps (27 skipped, 1 pending, 1 passed)
0m2.938s

The built-in html formatter also shows scenarios as passed, failed, or pending.

…es other than failed or passed.

A feature or scenario can now have a status of 'pending' or 'undefined', similar to what the built-in
cucumber runner does and what the built-in cucumber html formatter does.
…tatus'

Conflicts:
	pom.xml
	src/test/java/net/masterthought/cucumber/generators/integrations/FeaturesOverviewPageIntegrationTest.java
Repository owner deleted a comment Jun 16, 2017
Repository owner deleted a comment Jun 16, 2017
Repository owner deleted a comment Jun 16, 2017
@bischoffdev
Copy link

Hello @SteveDonie!

Are you still working on this one?

Best,
Benjamin

@SteveDonie
Copy link
Author

SteveDonie commented Sep 8, 2017 via email

@bischoffdev
Copy link

bischoffdev commented Sep 9, 2017 via email

@ransom4real
Copy link

@SteveDonie do you have a working version of the plugin? I have been struggling to get your fix built without much luck. I am unsure why pending or skipped scenarios are seen as failed if this is not the case with steps.

@bischoffdev
Copy link

Hi, I actually ended up writing my own open source report plugin that solves this issue. If you are interested just drop me a line.

@ransom4real
Copy link

@laxersaz I would very much like to hear more about your report plugin. Does it work with Jenkins as well?

@bischoffdev
Copy link

Hi! It is a pure maven plugin. Here is the repo: https://github.com/trivago/cluecumber-report-plugin

@ransom4real
Copy link

@laxersaz can i integrate this into Jenkins? I wanted something i can integrate into Jenkins.

@bischoffdev
Copy link

It is not a Jenkins Plugin. However, if your Jenkins job triggers a Maven build, then Cluecumber can be used inside the Maven POM after your test runs. We use it that way for all of our Jenkins test jobs.

@silviatejera
Copy link

Hi,

How can I use this commit done on pull 636 on Jenkins? It's doing exactly what I want!
I tried as well the cluecumber report plugin, but pending steps are failing the scenario...

Thanks
Silvia

@bischoffdev
Copy link

Hi! Cluecumber should not fail the scenario in this case. Could you give me an example json of your case so I can test it?

@silviatejera
Copy link

Thanks,
This is the json file
report.zip

@bischoffdev
Copy link

Thanks, @silviatejera ! In your case, the scenario contains pending and skipped steps - that's why Cluecumber could not handle it correctly. I opened a bug on my side that will be fixed in the next release: trivago/cluecumber#29

@silviatejera
Copy link

Thanks @laxersaz

@sbpk516
Copy link

sbpk516 commented Feb 14, 2018

May i know, when this issue(Not marking "Pending" scenarios as "Failed" will be fixed?

@plank87
Copy link

plank87 commented Jul 13, 2018

We need cucumber reporting Jenkins plugins as our test cases are running regularly on Jenkins server. Is Cluecumber available on Jenkins. Also does it has the ability to combine mutiple Json files created from prallel run and create 1 consolidated report?

@bischoffdev
Copy link

bischoffdev commented Jul 13, 2018

Cluecumber is not available as a native Jenkins plugin. However, it can easily be used in a Jenkins CI (we are using it on Jenkins as well) by invoking it directly via the command line like so:
mvn cluecumber-report:reporting and then using the Jenkins publisher plugin to attach the report to the build: https://plugins.jenkins.io/htmlpublisher
And yes, it takes all JSON files from the specified directory and combines them into one report.

@kth13
Copy link

kth13 commented Sep 27, 2018

@laxersaz We are using gradle. Does cluecucumber-report supports gradle as well?

@bischoffdev
Copy link

Hello @kth13 , as I have too little gradle experience, I cannot really help you here (yet). In the future, I might consider porting Cluecumber over but at this moment, it is Maven only.
However, as far as I know you can also invoke maven goals through gradle (https://github.com/dkorotych/gradle-maven-exec-plugin) - maybe this would be an option?

@damianszczepanik damianszczepanik force-pushed the master branch 3 times, most recently from ff16211 to 6b5485d Compare May 28, 2019 23:07
…-reporting

Conflicts:
	src/main/java/net/masterthought/cucumber/json/Feature.java
	src/test/java/net/masterthought/cucumber/generators/integrations/FeaturesOverviewPageIntegrationTest.java
	src/test/java/net/masterthought/cucumber/generators/integrations/TagsOverviewPageIntegrationTest.java
@Sreejishnu777
Copy link

Hi @damianszczepanik

Could you please let me know here is there any further update on this. Can see this issue still although this thread is closed. If this is not getting fixed, is there any work around for this, something like not to fail the scenario if it has pending/skipped steps.
It would be great if you can update on this. Thanks a ton in advance.

@damianszczepanik
Copy link
Owner

Report new issue with details

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Jun 11, 2020

Cucumber v6 only supports strict mode now. Meaning pending and undefined steps are always a failure. So from v6 the report is always correct.

@nicodn
Copy link

nicodn commented Jun 11, 2020

What about skipped steps? Is there any way to prevent a skipped step from failing the entire scenario & feature?

We use jUnit Assume to skip steps that are not always required, but doing so makes our reports seem incorrect.

@Sreejishnu777
Copy link

Sreejishnu777 commented Jun 12, 2020

Hi @damianszczepanik,

Suppose we have 2 scenarios - Scenarios A & Scenario B and I have a test requirement that if Scenario A is failed, then I dont want to run Scenario B since it depends on Scenario A.
So in this case I use jUnit Assume to skip Scenario B. So overall scenario.getStatus() will return FAILED for Scenario A & SKIPPED for Scenario B. But in the cucumber reports Scenario B is shown as failed, which is not a right information.
Not really sure why there is no column for SKIPPED in the Scenarios column as shown below.
cucumberReport

Is this going to be addressed or is there any workaround for it?
Thanks.

@damianszczepanik
Copy link
Owner

Guys, this is just a report. It presents the state and it's up to you if you treat skipped or undefined steps as correct or incorrect case. However I'm not happy to make scenario as passed when it has not passed steps.

@staniere
Copy link

Hello,

I tried to configure cucumber_report in order to not fail the build if there are some skipped tests (skipped within jUnit Assume)
it seem to work with jenkins status, but not with Scenario and feature statuses whose remain to "failed"
cucumber_plugin_scenario_failed

perhaps did I not configure it correctly ?
cucumber_plugin_param

@juanmendes
Copy link

Guys, this is just a report. It presents the state and it's up to you if you treat skipped or undefined steps as correct or incorrect case. However I'm not happy to make scenario as passed when it has not passed steps.

It doesn't need to be marked as passing, just not as failing, it didn't run, it was intentionally skipped

@vireshshah
Copy link

+1. Current report is misleading where you already show some steps as "Skipped" but overall scenario is treated as "Failed". We should have separate column "Skipped" for Scenarios as well and over all status should be "Passed" as those tests were intentionally marked as skipped.

@vireshshah
Copy link

@SteveDonie Do you have newer version of Jenkins plugin which was created from your forked branch? If so, can you please pass it on?

@SteveDonie
Copy link
Author

SteveDonie commented Sep 30, 2021 via email

@skaba
Copy link

skaba commented Oct 5, 2021

This is so annoying, my build doesn't fail but report generates failed scenarios

@damianszczepanik
Copy link
Owner

The problem is not with the report which generates report based on the file you pass it but the step that makes test.

But anyway you can get the result and decide yourself when the build should fail and when it should not

@Yohandah
Copy link

i have the same issue as well, I launch a target that says 'dont execute tests with tags @ignore' and the reporter tells me these tests failed ........ well NO I didn't want to execute them they passed !

@geabby
Copy link

geabby commented Jan 7, 2022

Encountering same issue as tests were intentionally skipped. In this case was using cypress-tags to run tests on a certain tag eg @staging, unfortunately the result contains any test in the file which does not have the @staging tag and marks them as skipped. Wondering if anyone has any workaround to prevent the build failing in Jenkins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.