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

AssumptionViolatedException not causing test to be skipped #95

Closed
murphp15 opened this issue Nov 25, 2016 · 3 comments
Closed

AssumptionViolatedException not causing test to be skipped #95

murphp15 opened this issue Nov 25, 2016 · 3 comments

Comments

@murphp15
Copy link

Summary

We are migrating from an in house BDD framework to cucumber.
In our in house framework tests are skipped if the system is not in a certain state which can only be determined at runtime. We want to be able to support this in cucumber.
For example if test 1 is about to be run it will check that server x and y are active, if not it will skip this test.

Description

I have found a way to mimic this behaviour in cucumber except there seems to be a bug preventing us from doing it.
To mimic it I use tags(annotations) and the before command.
In the before command I check the state of the system, if the system is not how the test wants it then it will throw and org.junit.AssumptionViolatedException. This should cause the step to be skipped.
However we see that this causes the test to fail. We are running our tests in strict mode.

Possible Solution

I have fixed it in a local clone of your repo.
I made the following 2 changes to the file cucumber.runtime.Runtime./
In the runHookIfTagsMatch I added the section
if(isBefore){ status = isPending(t) ? "skipped" : Result.FAILED; }else{ status = isPending(t) ? "pending" : Result.FAILED; }

And in the runStep I changed the line
status = isPending(t) ? "pending" : Result.FAILED;
to
status = isPending(t) ? "skipped" : Result.FAILED;

I my no means see this as a full solution and it is untested on other use cases but I would be happy to work with you guys to implement a full solution for this issue.

Looking forward to hearing from you regards, Paul

@aslakhellesoy
Copy link
Contributor

Can you please create this issue in the cucumber-jvm project? Thanks!

@murphp15
Copy link
Author

Done. Thanks!

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants