Giter VIP home page Giter VIP logo

Comments (1)

GaelGirodon avatar GaelGirodon commented on July 2, 2024

After some research, I found that JUnit XML test report files can contain:

  • A root <testsuites> tag with multiple child <testsuite> tags (what I've seen the most during my browsing)
  • A single root <testsuite> tag (maybe not so common but yet valid)

The current implementation is based on report files like this one:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Tests" time="9.891" tests="62" failures="0">
  <testsuite name="mdtodoc" timestamp="2024-04-18T19:12:28" tests="1" file="[...]" time="0.285" failures="0">
    <testcase name="CLI mdtodoc should fail without argument" time="0.284" classname="should fail without argument"></testcase>
  </testsuite>
  <testsuite name="mdtodoc -h/--help" timestamp="2024-04-18T19:12:28" tests="2" file="[...]" time="0.556" failures="0">
    <testcase name="CLI mdtodoc -h/--help should display help (-h)" time="0.285" classname="should display help (-h)"></testcase>
    <testcase name="CLI mdtodoc -h/--help should display help (--help)" time="0.271" classname="should display help (--help)"></testcase>
  </testsuite>
  [...]
</testsuites>

But having the sum of tests and failures in the root <testsuites> tag doesn't seem to be the most common and standard (e.g. the jest-junit package generates a file with testsuites>testsuite>testcase tags hierarchy but doesn't output tests/failures sum in the root <testsuites> tag).

It may be more reliable to sum tests, failures and errors from each <testsuite> tag (whether there is only one at the root or multiple inside a root <testsuites> tag). That would make this loader more standard, thus supporting more report files, including yours (without breaking with mines).

Does it sound good to you?

P.S. Only the first valid report file (starting from the closest to the project root) is actually used to generate the badge. So make sure your test runner generates a single aggregated report file.

from ci-badges-action.

Related Issues (2)

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.