michaelsatish / junit-xml-viewer

A tiny cli application that can read a JUnit XML file and makes it readable.
MIT License
2 stars 0 forks source link

Omitted subsequent XML node entries after first testsuite in testsuites #1

Open hernanmd opened 9 months ago

hernanmd commented 9 months ago

Hello. I am using this input file : Combined.zip containing a single merged XML from multiple junit XML's (each XML was merged as child of testsuites node, under a testsuite node).

I execute it this way:

./junit-xml-viewer/bin/jxv -f Combined.xml

At some point the input string is empty, which caused an error. I tried "patching" GetSuccessCountto not read "Skipped", which is the call getting an empty value for my input file. However output is still omitted to the first testsuite. This means it only displays tests from my first suite: AI-Algorithms

// GetSuccessCount returns the number of successful tests.
func (ts *TestSuite) GetSuccessCount() int {
    intCov := func(s string) int {
        if s != "" {
            i, err := strconv.Atoi(s)
            checkError(err)
            return i
        } else {
            fmt.Println("String is empty, cannot convert.")
            return 0
        }
    }

    tests := intCov(ts.Tests)
    failures := intCov(ts.Failures)
    errors := intCov(ts.Errors)
    // skipped := intCov(ts.Skipped)

    //  return tests - failures - errors - skipped
    return tests - failures - errors
}

This is what I get

Screenshot 2024-01-23 at 17 24 29

Any hints would be appreciated.

michaelsatish commented 9 months ago

Hi @hernanmd

Thanks for opening an issue. There is no official specification for the JUnit XML file format. The one you have provided is missing the skipped attr. I have modified the code to handle this and made a new release 0.1.1

The dashboard will not render the skipped card if the attr is missing. Hope this helps.

image