no more duplication of test suites.

Parsing the test tree and deciding in the marsheller whether it is a
testcase (leaf) or a suite (non-leaf)
This commit is contained in:
2024-11-22 20:59:23 +01:00
parent 36563f55fb
commit e20795e7b9
2 changed files with 92 additions and 62 deletions
+36 -1
View File
@@ -9,8 +9,43 @@ import (
"path/filepath"
)
func main() {
func (t *Test) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if len(t.Tests) == 0 {
start.Name = xml.Name{Local: "testcase"}
classname := ""
if t.Parent != nil {
classname = t.Parent.Name
}
var skipped *Result
if t.Skipped > 0 {
skipped = &Result{
Message: "skipped",
}
}
var failed *Result
if t.Failures > 0 {
failed = &Result{
Message: "failed",
}
}
tc := Testcase{
Name: t.Name,
// parent class name
Classname: classname,
Time: t.Time,
Skipped: skipped,
Error: nil,
Failure: failed,
SystemOut: t.SystemOut,
}
return e.EncodeElement(tc, start)
}
type Alias Test
start.Name = xml.Name{Local: "testsuite"}
return e.EncodeElement(Alias(*t), start)
}
func main() {
/*
testsuites := Testsuites{
Time: 1.23,