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

How to get pending steps to not be seen as failures? #129

Closed
SteveDonie opened this issue Mar 8, 2017 · 31 comments
Closed

How to get pending steps to not be seen as failures? #129

SteveDonie opened this issue Mar 8, 2017 · 31 comments

Comments

@SteveDonie
Copy link

I've recently noticed that when a scenario has a step that returns 'pending' that the cucumber reports show the scenario as 'failed'. Is there a way to change that behavior? We use 'pending' to indicate that a certain dependency is not configured during a particular test run, and this is an expected condition.

I have tried setting the report plugin configuration "Number of pending steps" to a very high number (99999) and that does not seem to affect the result.

@damianszczepanik
Copy link
Member

This is done by design. What exactly are your expectations?

@SteveDonie
Copy link
Author

SteveDonie commented Mar 9, 2017

I would expect the scenario to report scenarios that have pending steps to report their overall status as pending.

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. I have attached a sample.
results.html.zip

I've also attached a screenshot showing what I am seeing with the cucumber-reports-plugin.
screenshot from 2017-03-09 09-53-59

@SteveDonie
Copy link
Author

Here's another html report with a single scenario that is pending.
results.html.zip

@damianszczepanik
Copy link
Member

Sorry but I don't see string enough reason for changing default behave

@SteveDonie
Copy link
Author

Thanks. I'll probably just change it in my fork then. Would you mind pointing me towards where the logic to calculate the overall results are computed?

@svsforsuccess
Copy link

But am planning to skip few scenarios so it would be greatly helpful if you add column for pending in scenarios and also if you could tell me the way to modify plugin code also should be fine...but i need it badly...thanks

@SteveDonie
Copy link
Author

SteveDonie commented Jun 13, 2017

I have made changes in my fork of cucumber-reporting that do almost all that is needed. The main reports now show pending and undefined steps/scenarios/features. The only thing I have not implemented is the trend reporting.

screenshot from 2017-06-13 10-14-09

If you'd like to get the code, see pull request 636: damianszczepanik/cucumber-reporting#636

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Jun 13, 2017

I've recently noticed that when a scenario has a step that returns 'pending' that the cucumber reports show the scenario as 'failed'. Is there a way to change that behavior? We use 'pending' to indicate that a certain dependency is not configured during a particular test run, and this is an expected condition.

When executing cucumber tests in the strict mode, pending steps will fail the test so rendering pending as failures not strictly speaking wrong. I guess what you're looking for is to mimic this strict mode in the report.

Semantically it is wrong to use Pending to mean not executed due to failing preconditions. However once cucumber-jvm 2.0.0 is out you'll be able to use Junit Assume to do just this.

Can't provide an eta. on that but we do have snapshot releases.

        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>${cucumber.version}</version>
            <scope>test</scope>
        </dependency>

        <repository>
            <id>sonatype-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

@svsforsuccess
Copy link

svsforsuccess commented Jun 13, 2017 via email

@svsforsuccess
Copy link

svsforsuccess commented Jun 14, 2017 via email

@vitaliy-sharandin
Copy link

This implementation seems quite reasonable, as Pending status tells us something was not yet implemented or is ommited on purpose. If something is wrong with stepdef(therefore scenario), there are failed and undefined statuses. So, +1 vote to see this in official implementation of plugin.

We have our own BDD framework and we didn't have Pending exception yet, so I'm implementing it right now and it kind of depends on this plugin what statuses will I pass to scenario level.
So, is there any chance this will be implemented or I should not hope for this useful feature?

@svsforsuccess
Copy link

svsforsuccess commented Jun 27, 2017 via email

@damianszczepanik
Copy link
Member

Looks like there is need to add feature that was removed time ago because some problems with consistency. I need to think it over again

@vitaliy-sharandin
Copy link

It would be a very helpful feature. Thanks:)

@LucasSq
Copy link

LucasSq commented Jul 6, 2017

This would be helpful for my project too :)

@jess8147
Copy link

jess8147 commented Sep 6, 2017

+1 for this feature requirement

@KLBonn
Copy link
Contributor

KLBonn commented Oct 16, 2017

+1 from me

The result view shown by @SteveDonie ( comment above / PR 636 ) would be exactly what we need.

"undefined" and "pending" should be differentiated from "failed":

  • "undefined" or "pending" is used for: planned "work in progress", no special action implied.
  • "failed" should be reserved for: Problems with application under test or test environment --> immediate action required!

Choosing between "undefined" and "pending" could be subject to discussion and local interpretation, but at least they should be visible up to feature level (instead of just "failed").

@damianszczepanik
Copy link
Member

Would it be OK to add tow new flags: one for undefined and second for pending so it defines if the steps should be counted as passed or failed?

@SteveDonie
Copy link
Author

@damianszczepanik I don't think that your suggestion of new flags meets my needs at all. I don't want a feature or a scenario to be limited to a passed or failed state - I actually like knowing that a scenario is 'pending' or 'undefined' - I see these as communicating more richly what the state of things is.

@damianszczepanik
Copy link
Member

What when scenario has steps with different statuses?

@KLBonn
Copy link
Contributor

KLBonn commented Oct 21, 2017 via email

@SteveDonie
Copy link
Author

@KLBonn If you look at the diff in pull request 636, you'll see that is exactly what I have done.

See https://github.com/damianszczepanik/cucumber-reporting/pull/636/files#diff-8350411954262e85f9d3bee0c77b2879

@svsforsuccess
Copy link

svsforsuccess commented Oct 21, 2017 via email

@damianszczepanik
Copy link
Member

Based on https://github.com/damianszczepanik/cucumber-reporting/blob/master/src/main/java/net/masterthought/cucumber/json/support/Status.java#L17-L19 I'm not really sure if this is clear to everybody what is the relation between those three. So I have concern if by introducing three new statuses for scenarios and features we introduce some doubts what is the different between pending and skipped for feature. It is not as clear as for steps which is very small unit.

@KLBonn
Copy link
Contributor

KLBonn commented Oct 23, 2017

Yes, looking at the code of PR 636, we seem to share the same idea here :-)

@damianszczepanik Maybe we could introduce a flag / feature toggle for that new behaviour?
So people could choose between "simple status" and "detailed status".

Then anyone confused by differentiated statuses can drop down to showing every non-passing scenario/feature as failed.

Of course, a description / definition of the meaning for each status should be part of the documentation, anyway.
(Anyone in need for a special "interpretation" could choose to "misuse" e.g. Pending status on his/her project, but the need to show that status even on feature level would stay the same)

@kalyankp
Copy link

Hi ,
@damianszczepanik - I am still confused, with the present cucumber-report plugin how does ""Number of pending steps" works? I have also tried giving 9999 in the "Number of pending steps" field , where as I have 7 pending steps in my Json. But still it overall status is failed.
Please suggest some quick solution for it.

Thank you.

@damianszczepanik
Copy link
Member

Probably other statuses are set to zero while your report has more. Validate other statuses.

@kalyankp
Copy link

Hi,
@damianszczepanik - Here I am attaching cucumber-report screenshot and configuration screenshot, Please see and let me know what mistake I am doing in configuration.

cucumber-config
cucumber-report

@damianszczepanik
Copy link
Member

OK, now I understand, this is duplicate of damianszczepanik/cucumber-reporting#636

@UltimateGeek
Copy link

The referenced pull request, damianszczepanik/cucumber-reporting#636 is going into the Datical fork, not jenkinsci. Why was this issue's status changed to closed?

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

No branches or pull requests

10 participants