github.com/kubeshop/testkube@v1.17.23/contrib/executor/jmeter/pkg/parser/xunit.go (about)

     1  package parser
     2  
     3  import (
     4  	"encoding/xml"
     5  )
     6  
     7  // Testsuites is a root element of junit report
     8  type Testsuites struct {
     9  	XMLName    xml.Name    `xml:"testsuites"`
    10  	Testsuites []Testsuite `xml:"testsuite,omitempty"`
    11  	Name       string      `xml:"name,attr,omitempty"`
    12  	Tests      int         `xml:"tests,attr,omitempty"`
    13  	Failures   int         `xml:"failures,attr,omitempty"`
    14  	Errors     int         `xml:"errors,attr,omitempty"`
    15  	Skipped    int         `xml:"skipped,attr,omitempty"`
    16  	Assertions int         `xml:"assertions,attr,omitempty"`
    17  	Time       float32     `xml:"time,attr,omitempty"`
    18  	Timestamp  string      `xml:"timestamp,attr,omitempty"`
    19  }
    20  
    21  // Testsuite contains testsuite definition
    22  type Testsuite struct {
    23  	XMLName    xml.Name   `xml:"testsuite"`
    24  	Testcases  []Testcase `xml:"testcase"`
    25  	Name       string     `xml:"name,attr"`
    26  	Tests      int        `xml:"tests,attr"`
    27  	Failures   int        `xml:"failures,attr"`
    28  	Errors     int        `xml:"errors,attr"`
    29  	Skipped    int        `xml:"skipped,attr,omitempty"`
    30  	Assertions int        `xml:"assertions,attr,omitempty"`
    31  	Time       float32    `xml:"time,attr"`
    32  	Timestamp  string     `xml:"timestamp,attr,omitempty"`
    33  	File       string     `xml:"file,attr,omitempty"`
    34  }
    35  
    36  // TestResult represents the result of a testcase
    37  type TestResult struct {
    38  	Message string `xml:"message,attr"`
    39  	Type    string `xml:"type,attr,omitempty"`
    40  }
    41  
    42  // Testcase define a testcase
    43  type Testcase struct {
    44  	XMLName    xml.Name    `xml:"testcase"`
    45  	Name       string      `xml:"name,attr"`
    46  	ClassName  string      `xml:"classname,attr"`
    47  	Assertions int         `xml:"assertions,attr,omitempty"`
    48  	Time       float32     `xml:"time,attr,omitempty"`
    49  	File       string      `xml:"file,attr,omitempty"`
    50  	Line       int         `xml:"line,attr,omitempty"`
    51  	Skipped    *TestResult `xml:"skipped,omitempty"`
    52  	Failure    *TestResult `xml:"failure,omitempty"`
    53  	Error      *TestResult `xml:"error,omitempty"`
    54  }