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

[Question] Assert that a Step throws a specific exception aka bypass StepInterceptor temporarily #2472

Closed
parraline5750 opened this issue May 28, 2021 · 0 comments

Comments

@parraline5750
Copy link

Forgive a stupid question. Is it possible within the realm of how the StepInterceptor works, to achieve the following within a JUnit test using :

assertThatThrownBy(() -> someSerenityStepAnnotatedMethod()).isInstanceOf(ElementNotInteractableException.class);

I understand that StepEventBus.getEventBus().getBaseStepListener().getTestFailureCause().getOriginalCause() will give me ultimately what caused it to fail, but the test will still fail. I find it irksome that I cannot use this type of verification within a test. I have tried using Serenity.throwExceptionsImmediately() based on wandering through the issues for this project, and the Googles, but I cannot seem to find a workaround.

@parraline5750 parraline5750 changed the title Assert that a Step throws a specific exception aka bypass StepInterceptor temporarily [Question] Assert that a Step throws a specific exception aka bypass StepInterceptor temporarily May 28, 2021
@wakaleo wakaleo closed this as completed Feb 12, 2022
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

2 participants