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

Added failed scenario statistics to progress statistics printer #1392

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

patrinos
Copy link

When using the --progress option with behat there was a situation where an issue failed in an @afterstep context. The information printed to the output was not sufficient to determine in which feature file or scenario the issue occured. With the simple addition proposed a listing of the failed scenarios will be printed at the end of the run, thus greatly simplifying the task of finding the offending scenario, especially in a large suite such as ours with hundreds of feature files.

Example:
`
[2022-06-20T14:18:31.605Z] ...................................................................... 5180

[2022-06-20T14:18:36.955Z] ...................................................................... 5250

[2022-06-20T14:18:40.835Z] ..................................................----

[2022-06-20T14:18:40.835Z]

[2022-06-20T14:18:40.835Z] --- Failed hooks:

[2022-06-20T14:18:40.835Z]

[2022-06-20T14:18:40.835Z] AfterStep # ****Context::verifyHtml()

[2022-06-20T14:18:40.835Z] Behat\Mink\Exception\ExpectationException: HTML errors were found in page: http://web:8080/************ Errors:

[2022-06-20T14:18:40.835Z] Line: 183 Error: Element “div” not allowed as child of element “a” in this context.

(Suppressing further errors from this subtree.)

[2022-06-20T14:18:40.835Z] Line: 183 Error: Heading cannot be a child of another heading.

[2022-06-20T14:18:40.835Z] Line: 183 Error: Stray end tag “h2”. in sites/default/modules/custom/eyp/eyp.behat.inc:900

[2022-06-20T14:18:40.835Z] Stack trace:

[2022-06-20T14:18:40.835Z]

[2022-06-20T14:18:40.835Z] 689 scenarios (688 passed, 1 failed)

[2022-06-20T14:18:40.835Z] 5304 steps (5300 passed, 4 skipped)

[2022-06-20T14:18:40.835Z] 10m33.02s (195.65Mb)

script returned exit code 1
`

@ciaranmcnulty
Copy link
Contributor

Can you add a test for this please?

@patrinos
Copy link
Author

patrinos commented Jun 30, 2022 via email

@ciaranmcnulty
Copy link
Contributor

If there's one you can modify that is clear, that's fine.

I'm working on fixing the test suite so you may need to rebase

@patrinos
Copy link
Author

patrinos commented Jun 30, 2022 via email

@patrinos
Copy link
Author

patrinos commented Jul 1, 2022 via email

@ciaranmcnulty ciaranmcnulty force-pushed the Add-failing-scenarios-to-progress-statistics branch from 0decf54 to d347c98 Compare July 7, 2022 12:07
@ciaranmcnulty
Copy link
Contributor

@patrinos can you check the feature I've added captures what you intended please?

@ciaranmcnulty
Copy link
Contributor

Hm, when it's a failing step the extra information seems redundant

Maybe a better solution would be to make sure the scenario is included in the failing step output?

@patrinos
Copy link
Author

patrinos commented Jul 7, 2022

Personally I wouldn't mind a couple of extra lines of output when already thousands have been avoided. I'm not sure how easy it would be to implement a more granular approach. Until this is done, I think this a good enough addition that guides the developer to exactly what needs to be fixed.

@ciaranmcnulty Of course if your suggested fix is easy to implement, it's fine with me.

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

Successfully merging this pull request may close these issues.

None yet

2 participants