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

[jUnit formatter] Skipped steps are considered as errors #375

Open
mdelapenya opened this issue Feb 10, 2021 · 3 comments
Open

[jUnit formatter] Skipped steps are considered as errors #375

mdelapenya opened this issue Feb 10, 2021 · 3 comments

Comments

@mdelapenya
Copy link

We noticed that when a step fails in an scenario, subsequent steps are marked as skipped, which is OK imho.

When processing a test case (a scenario), all the steps that are skipped are included as errors (although having the skipped type). And because they are marked as error XML elements, we are not able to identify the root cause of why the scenario failed.

But why? Because the CI (Jenkins) provides a higher ranking to errors than to failures, causing the UI to display the fist step error instead of the first failure, which is misleading. I.e.:

<testsuites name="main" tests="29" skipped="0" failures="29" errors="0" time="377.75344176">
    <testsuite name="Integrations" tests="27" skipped="0" failures="27" errors="0" time="322.571063757">
        <testcase name="activemq-5.13.0 sends metrics to Elasticsearch without errors" status="failed" time="5.936670176">
            <failure message="Step metricbeat is installed and configured for "activemq" module: stat /var/lib/jenkins/workspace/Beats_beats_PR-23854/src/github.com/elastic/beats/x-pack/metricbeat/build/distributions/metricbeat-8.0.0-SNAPSHOT-linux-amd64.docker.tar.gz: no such file or directory"/>
            <error message="Step there are "activemq" events in the index" type="skipped"/>
            <error message="Step there are no errors in the index" type="skipped"/>
        </testcase>
    </testsuite>
</testsuites>

Screenshot 2021-02-10 at 13 22 37

Thankfully we store the XML file and then we were able to read the real error, hid by the first error.

With the above XML file, I'd expect the UI to display the failure step. In fact, removing all errors simply keeping failures makes the UI to display the proper error message.

Note: we are aware that, potentially, it could be an issue in the Jenkins side where errors are overriding the real failure, but wanted to share here our expectations first.

@lonnblad
Copy link
Member

Hi @mdelapenya, thanks for the issue!

@mpkorstanje, do you have any insight on how we do this for other Cucumber implementations.

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Feb 10, 2021

This is a rather complex issue:

  1. Cucumber-JVM only reports the most severe result for a scenario rather then the results of all steps.
  2. Depending on which XSD you pick, you get a different answer to the question if multiple test results are allowed at all:
  1. Should multiple be results be allowed in practice, then if I'm not mistaken error is worse then failure. The latter implies the test failed, for example on an assertion. The former suggests the tests stopped in a completely unexpected fashion. So it may be that Jenkins picks the first, most severe result when given a choice. But that is speculation on my end.
  2. I believe both failure.type and error.type refer to the type of the error. Using skipped here would not be appropriate.
  3. failure.type is mandatory according to the xsd but currently missing.
  4. If multiple results are allowed, using the skipped element would probably be more appropriate then error with type="skipped".

@mdelapenya
Copy link
Author

I tried to use <Skipped/> elements instead, and jenkins populated the UI with two messages: one for the failure and one for the first skipped step

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

3 participants