-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Support specifying when @BeforePropety is invoked in relation to hooks #395
Comments
Well, in theory (I just checked the code), the proximity of any I extended the tests to make that clear: https://github.com/jlink/jqwik/blob/main/engine/src/test/java/net/jqwik/engine/execution/lifecycle/LifecycleMethodsTests.java That said, it could be a new feature to influence the proximity of individual before/after methods through an attribute in |
I assume I could answer your question. If not, please re-open the issue. |
Aha. Thanks @jlink. I completely missed this. It will do for now! However, I agree that it would probably be useful to be able to influence this on a per-test basis. |
Would ˋAddLifecycleHook(value=HookClass.class, proximity = 100)ˋ do? |
Yeah... That would work. I think it would also make it clearer in showing in what order things fire if it had the default for that property set as referenced in the documentation in your previous comment. One case to consider would be if the hook is defined on the class rather than per-method and how one overrides the other. I guess whenever that fine grained control is needed, it's not the end of the world to have to define it for each method though. |
@adam-waldenberg As described in #398 it's not as simple as I originally thought it could be. |
Testing Problem
There doesn't seem to be a way to control if @BeforeProperty methods should be invoked before or after hooks. At first, I thought the proximity influenced this, but this does not seem to affect anything else than how hooks are executed in relation to each other.
Suggested Solution
Maybe add a @BeforePropertty(beforeHooks=true/false). Alternatively add a "proximity" to when methods with these annotations are executed and then allow the hooks to work around them by setting proximity().
The text was updated successfully, but these errors were encountered: