Code Monkey home page Code Monkey logo

Comments (6)

mikocot avatar mikocot commented on August 23, 2024 1

Hi, I haven't thought about it. Since, I didn't see the actual code written with this paradigm utilizing nested groups feature. So, how about having it in a more generic way: just parse groups recurcively allowing any nesting level?

I'm curious if the following output xml will work for your case?:

    <?xml version=\"1.0\"?>
    <testsuites tests=\"6\" failures=\"3\">
      <testsuite id=\"0\" name=\"First Test Suite: Required fields\" tests=\"2\" failures=\"0\">
        <testcase name=\"expected response status to equal 204\" classname=\"First Test Suite: Required fields\" />
        <testcase name=\"expected response to be truthy\" classname=\"First Test Suite: Required fields\" />
      </testsuite>
      <testsuite id=\"1\" name=\"First Test Suite: Required and optional fields\" tests=\"1\" failures=\"0\">
        <testcase name=\"expected response status to equal 204\" classname=\"First Test Suite: Required and optional fields\" />
      </testsuite>
      <testsuite id=\"2\" name=\"Second Test Suite: Manage User\" tests=\"1\" failures=\"1\">
        <testcase name=\"expected Create instance response status to equal 201\" classname=\"Second Test Suite: Manage User\" >
          <failure message=\"0 / 1 (0.00%) checks passed\">0 / 1 (0.00%) checks passed</failure>
        </testcase>
      </testsuite>
      <testsuite id=\"3\" name=\"Second Test Suite: Manage Group\" tests=\"1\" failures=\"1\">
        <testcase name=\"expected Create tenant response status to equal 201\" classname=\"Second Test Suite: Manage Group\" >
          <failure message=\"0 / 1 (0.00%) checks passed\">0 / 1 (0.00%) checks passed</failure>
        </testcase>
      </testsuite>
      <testsuite id=\"4\" name=\"Thresholds\" tests=\"1\" failures=\"1\">
        <testcase name=\"checks: rate == 1.00\" classname=\"Thresholds\" >
          <failure message=\"threshold exceeded\">threshold exceeded</failure>
        </testcase>
      </testsuite>
    </testsuites>

That was my first idea actually, but then if you use it for CI/CD for example, which I believe is a pretty common case you end up with reporting of dozens of test suites, each of them having 1, 2, maybe 5 tests each. This is not very helpful.

I can imagine having a breakdown at one more level level deeper could be interesting for huge projects, but would be counterproductive for small, so probably the best alternative would be to parametrize it. We could pass current level in recursion and compare with the max-depth value

from k6-junit.

simbadltd avatar simbadltd commented on August 23, 2024 1

Done, now you should see yourself as a contributor. New version has been already published. Latest version: 1.1.2. Enjoy your day and happy coding!

from k6-junit.

mikocot avatar mikocot commented on August 23, 2024

Issue addressed in PR: #11
It's one of the approaches on how this can be handled. It feels the most adequate for my use, but also seems to be a good compromise in general. The code can be easily turned to support unlimited amount of nesting with listing each of the test suites. Or even nesting them if the format allows it.

from k6-junit.

simbadltd avatar simbadltd commented on August 23, 2024

Hi, I haven't thought about it. Since, I didn't see the actual code written with this paradigm utilizing nested groups feature. So, how about having it in a more generic way: just parse groups recurcively allowing any nesting level?

I'm curious if the following output xml will work for your case?:

    <?xml version=\"1.0\"?>
    <testsuites tests=\"6\" failures=\"3\">
      <testsuite id=\"0\" name=\"First Test Suite: Required fields\" tests=\"2\" failures=\"0\">
        <testcase name=\"expected response status to equal 204\" classname=\"First Test Suite: Required fields\" />
        <testcase name=\"expected response to be truthy\" classname=\"First Test Suite: Required fields\" />
      </testsuite>
      <testsuite id=\"1\" name=\"First Test Suite: Required and optional fields\" tests=\"1\" failures=\"0\">
        <testcase name=\"expected response status to equal 204\" classname=\"First Test Suite: Required and optional fields\" />
      </testsuite>
      <testsuite id=\"2\" name=\"Second Test Suite: Manage User\" tests=\"1\" failures=\"1\">
        <testcase name=\"expected Create instance response status to equal 201\" classname=\"Second Test Suite: Manage User\" >
          <failure message=\"0 / 1 (0.00%) checks passed\">0 / 1 (0.00%) checks passed</failure>
        </testcase>
      </testsuite>
      <testsuite id=\"3\" name=\"Second Test Suite: Manage Group\" tests=\"1\" failures=\"1\">
        <testcase name=\"expected Create tenant response status to equal 201\" classname=\"Second Test Suite: Manage Group\" >
          <failure message=\"0 / 1 (0.00%) checks passed\">0 / 1 (0.00%) checks passed</failure>
        </testcase>
      </testsuite>
      <testsuite id=\"4\" name=\"Thresholds\" tests=\"1\" failures=\"1\">
        <testcase name=\"checks: rate == 1.00\" classname=\"Thresholds\" >
          <failure message=\"threshold exceeded\">threshold exceeded</failure>
        </testcase>
      </testsuite>
    </testsuites>

from k6-junit.

simbadltd avatar simbadltd commented on August 23, 2024

@mikocot Great idea! I've added maxGroupNestingLevel config for that, so to fit your case you need to set it up to 2. Your case also has been included as a test here: _issue.10.spec.jsx.
Thanks for highlighting this and Happy coding!

from k6-junit.

mikocot avatar mikocot commented on August 23, 2024

Cool, thanks for adding it. I just don't understand why you couldn't do it on top of my PR, instead of copying the code into main

from k6-junit.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.