From e0207bab2a240db94b5493e6dd04f753c8a4c4a8 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Wed, 20 Nov 2024 23:25:27 +0100 Subject: [PATCH] now using classname in testcases to refer to the testsuite --- cmd/go2junit/output.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/go2junit/output.go b/cmd/go2junit/output.go index 2a7f678..5fe3c62 100644 --- a/cmd/go2junit/output.go +++ b/cmd/go2junit/output.go @@ -3,7 +3,6 @@ package main import ( "encoding/xml" "log" - "strings" "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 { - path := strings.Split(testname, "/") - for i := 0; i < len(path)-1; i++ { - suite = suite.getSuite(t, path[i]) - } + //path := strings.Split(testname, "/") + //for i := 0; i < len(path)-1; i++ { + // suite = suite.getSuite(t, path[i]) + //} for _, test := range suite.Testcases { - if test.Name == path[len(path)-1] { + if test.Name == testname { return test } } - if path[len(path)-1] == "" { + if testname == "" { panic("Empty testcase") } test := Testcase{ - Name: path[len(path)-1], + Name: testname, + Classname: suite.Name, } suite.Testcases = append(suite.Testcases, &test) return &test