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

Do not execute @Hidden methods like normal step methods #103

Closed
janschaefer opened this issue Aug 8, 2015 · 3 comments
Closed

Do not execute @Hidden methods like normal step methods #103

janschaefer opened this issue Aug 8, 2015 · 3 comments

Comments

@janschaefer
Copy link
Contributor

Currently @Hidden-annotated methods are executed like normal step methods, but just do not appear in the report. This causes problems when the hidden method is not returning the stage instance as required for step methods and then an exception is thrown in previous step methods.

Example:

given().something()
  .and().a_step_throwing_an_exception();
String value = given().giveMeSomeValue();

As JGiven captures the exception in the 2nd step and tries to execute the following methods in a skipped-mode so that they can appear in the report, value will be null, because JGiven executes the giveMeSomeValue method in skipped-mode. If value is then used in further steps as an argument, it will appear as null in the report.

There are two possible solutions to this problem:

  1. Execute hidden methods in skipped mode. This might have the problem that these methods might throw exceptions themselves if previous steps already failed.
  2. Whenever hitting a hidden method just stop trying to further execute the scenario in skipped mode and just finish the scenario. This has the problem that following steps will not appear in the report as skipped.
  3. Make the behavior configurable
@wolfs
Copy link
Contributor

wolfs commented Aug 9, 2015

Point 1. probably should read: "Execute hidden methods in skipped mode".

@janschaefer
Copy link
Contributor Author

true, fixed.

@janschaefer janschaefer added this to the 0.8.2 milestone Sep 11, 2015
@janschaefer
Copy link
Contributor Author

I decided to introduce a new annotation @DoNotIntercept for this use case. I didn't find a better name ;-)

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

2 participants