-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Json formater reports results incorrectly when there is an exception in the Around block #909
Comments
Thanks for the excellent bug report. Around hooks are implemented in a peculiar way, so I can imagine how something like this could happen. |
The big underlying problem here is in IMHO that with (the current implementation of) around hooks and I have realized that around hooks are not reported as test steps to the formatters, and to some extent deciding when to send |
There's a fundamental problem with the current modelling of Around hooks, for me. Around hooks are not test steps themselves - the entire test case is nested within the Around hook. It's almost like they're test cases that contain test cases, Russian-doll style. In that (Russian-doll) model, we'd need for the formatters to be able to deal with test cases to fail without any test steps. I can envisage other reasons why test cases without steps might fail (e.g. they fail a new strict rule about scenario names being mandatory, or we have a new rule that says scenarios without steps should be marked as pending). So maybe we should reconsider the invariant and make the formatters able to cope with this situation? WDYT? |
A conflict here is that the json report does not include the result for a scenario, only the results for all the steps and hooks of it. And introducing the result for the scenario, would probably mean that all existing tools that process the json report would ignore them anyway. Pragmatically we could change the JsonFormatter to detect if the |
I see. That sounds like a good workaround. We could even do that deeper within Cucumber (effectively modelling the Around hook code as a TestStep), but I wonder whether that would just end up as confusing...? |
One questing from this example is when using an around hook to wrap the execution of a test case in a timeout, will the formatters still receive paired
In that case the invariant that if |
A timeout in an around hook can interrupt a running test step. From the perspective of formatters, the invariant that both before_test_step and after_test_step is received for each step, should hold also in this case. Fixes the main part of cucumber/cucumber-ruby#909.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi,
I want to fail tests that take too long, that's why I am using a timeout in the Around block, as per the documentation. The problem with the json formatter is that when a timeout happens the test step is not marked as failure.
Feature File:
Step Definitions
Output:
Expected Output:
I believe the error occurs because the Formatter::Json#after_test_step is not called, when there is an exception in the around block
This error impacts those who Jenkins because the jenkins plug-in depends on the json formatter working properly.
Versions:
Ruby 2.2.1p85
Cucumber 2.0.2
The text was updated successfully, but these errors were encountered: