-
Notifications
You must be signed in to change notification settings - Fork 98
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
jgiven interferes with testng failures handling mechanism #312
Comments
Yes. JGiven catches all exceptions. So number 3 is expected behavior. This is to be able to show steps as skipped that follow the failed step. I have to look deeper in this issue and see how this is related to the retryAnalyzer and why number 2 is not working as expected, because JGiven passes the exception to TestNG, but maybe there is some ordering issue and the retryAnalyzer is evaluated before JGiven passes the exception back to TestNG. |
I believe that this can be related to a possible bug that i found. @Override
public void onTestSuccess(ITestResult result) {
super.onTestSuccess(result);
if(result.getStatus() == ITestResult.FAILURE){
result.getTestContext().getFailedTests().addResult(result, result.getMethod());
result.getTestContext().getPassedTests().removeResult(result);
}
} I believe that it's not necessary to extend the @adrian-herscu, maybe you can test this to see if this works for your problem. In any case, i think this should be included in the |
@p-brz tried your solution... unfortunatelly, no joy :( Added @listeners({ScenarioTestListenerEx.class}) to the class above, added logs and got the following:
So, everything seems hooked fine. Do I miss something? |
I am having the same problem, any updates on how to work around it? |
I barely remember what the problem was...
From 50,000 feet... JGiven does not play nice with every TestNG feature.
So, if you plan using retries, concurrency and/or dependencies, you should
expect trouble.
…On Thu, 11 Apr 2019 at 14:49, Vinícius S. Pazzini ***@***.***> wrote:
I am having the same problem, any updates on how to work around it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#312 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AC25QXWmiV-E3H98Y7XIHtFEAOxe_sDDks5vfyFEgaJpZM4MsxDu>
.
|
The problem is that jgiven intercepts all exceptions, so testng can't see that the
test failed. Is there a way to make given not ok intercept those exceptions?
|
I decided to fix this issue by changing the behavior of JGiven to not catch exceptions in steps anymore in TestNG tests. See #422. |
Using TestNG 6.11 with JGiven 0.14.
I am trying to implement a generic mechanism that repeats failing tests with predefined repetition and interval configuration.
In TestNG there is a retryAnalyzer attribute on the @Test annotation.
It appears that JGiven somehow catches AssertionErrors and does not pass them to TestNG correctly, hence the my attached RetryAnalyzer does not get invoked.
Here is an example code:
The text was updated successfully, but these errors were encountered: