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 handle JUnit's assume() within JGiven #185

Closed
ahus1 opened this issue Jan 31, 2016 · 4 comments
Closed

How to handle JUnit's assume() within JGiven #185

ahus1 opened this issue Jan 31, 2016 · 4 comments
Milestone

Comments

@ahus1
Copy link
Contributor

ahus1 commented Jan 31, 2016

In a BDD web testing setup I use a scenario "Given you use Firefox", that leads to an

assumeThat(c.getCapabilities().getBrowserName(), Matchers.equalToIgnoringCase("firefox"));

When running this on JUnit, it marks the test case as ignored due to an AssumptionViolatedException.

Looking at the JGiven (HTML5) report it marks the scenario as failed.

Given   you use firefox  !failed
/* ...*/
FAILED: org.junit.AssumptionViolatedException: got: "phantomjs", expected: equalToIgnoringCase("firefox")

There is currently no "Ignored" ExecutionStatus within JGiven, only Failed and Pending (including the filters in the HTML5 report). Should there be a new state Ignored?

Best regards,
Alexander

@janschaefer
Copy link
Contributor

Ok, it should definitely be treated as pending and not as failed. Whether it is useful to introduce an Ignored state, I am not sure. In particular, tests that are Ignored by JUnit by the @ignore annotation, might even not be trackable by JGiven.

@janschaefer
Copy link
Contributor

The solution is as follows now: when throwing an AssumptionViolationException, the scenario will not appear in the report at all. This is identical to the case where a test is annotated with @Skipped

@phusilac
Copy link

@janschaefer I think that org.testng.SkipException should be treated the same way.
I would like to use AssertJ assumptions to skip a TestNG test but when SkipException is thrown the test is marked as failed instead.

@janschaefer
Copy link
Contributor

Totally agree. I opened a new issue for that #355

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

No branches or pull requests

3 participants