now using classname in testcases to refer to the testsuite

This commit is contained in:
Erik Brakkee 2024-11-20 23:25:27 +01:00
parent 37f4359dcb
commit e0207bab2a

View File

@ -3,7 +3,6 @@ package main
import ( import (
"encoding/xml" "encoding/xml"
"log" "log"
"strings"
"time" "time"
) )
@ -91,20 +90,21 @@ func (suite *Testsuite) getSuite(t time.Time, name string) *Testsuite {
} }
func (suite *Testsuite) getTest(t time.Time, testname string) *Testcase { func (suite *Testsuite) getTest(t time.Time, testname string) *Testcase {
path := strings.Split(testname, "/") //path := strings.Split(testname, "/")
for i := 0; i < len(path)-1; i++ { //for i := 0; i < len(path)-1; i++ {
suite = suite.getSuite(t, path[i]) // suite = suite.getSuite(t, path[i])
} //}
for _, test := range suite.Testcases { for _, test := range suite.Testcases {
if test.Name == path[len(path)-1] { if test.Name == testname {
return test return test
} }
} }
if path[len(path)-1] == "" { if testname == "" {
panic("Empty testcase") panic("Empty testcase")
} }
test := Testcase{ test := Testcase{
Name: path[len(path)-1], Name: testname,
Classname: suite.Name,
} }
suite.Testcases = append(suite.Testcases, &test) suite.Testcases = append(suite.Testcases, &test)
return &test return &test