From 79c6a72b32b317713163c05fd9f791cb02ad1892 Mon Sep 17 00:00:00 2001 From: renyijiu Date: Sat, 6 May 2023 18:19:16 +0800 Subject: [PATCH 1/2] feat: support test case property --- ingest.go | 9 ++++++++- ingest_test.go | 2 ++ testdata/cubic.xml | 9 ++++++++- testdata/python-junit-xml.xml | 3 +++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ingest.go b/ingest.go index 94266a7..67b730e 100644 --- a/ingest.go +++ b/ingest.go @@ -41,7 +41,9 @@ func ingestSuite(root xmlNode) Suite { suite.Tests = append(suite.Tests, testcase) case "properties": props := ingestProperties(node) - suite.Properties = props + for k, v := range props { + suite.Properties[k] = v + } case "system-out": suite.SystemOut = string(node.Content) case "system-err": @@ -90,6 +92,11 @@ func ingestTestcase(root xmlNode) Test { test.Status = StatusError test.Message = node.Attr("message") test.Error = ingestError(node) + case "properties": + props := ingestProperties(node) + for k, v := range props { + test.Properties[k] = v + } case "system-out": test.SystemOut = string(node.Content) case "system-err": diff --git a/ingest_test.go b/ingest_test.go index 181f7ae..16748c1 100644 --- a/ingest_test.go +++ b/ingest_test.go @@ -107,6 +107,8 @@ func TestExamplesInTheWild(t *testing.T) { assertLen(t, suites[0].Tests, 1) assertEqual(t, "\n I am stdout!\n ", suites[0].Tests[0].SystemOut) assertEqual(t, "\n I am stderr!\n ", suites[0].Tests[0].SystemErr) + assertEqual(t, "some.property.value", suites[0].Tests[0].Properties["some.property.name"]) + assertEqual(t, "some.class.name", suites[0].Tests[0].Properties["classname"]) }, }, { diff --git a/testdata/cubic.xml b/testdata/cubic.xml index eb695db..3dad3b8 100644 --- a/testdata/cubic.xml +++ b/testdata/cubic.xml @@ -66,7 +66,14 @@ type="" > - + + + + + + + STDOUT text diff --git a/testdata/python-junit-xml.xml b/testdata/python-junit-xml.xml index 3957224..c8ecbfc 100644 --- a/testdata/python-junit-xml.xml +++ b/testdata/python-junit-xml.xml @@ -2,6 +2,9 @@ + + + I am stdout! From c5554c1c2e21e4425f56daa350299d680dbe54e1 Mon Sep 17 00:00:00 2001 From: renyijiu Date: Sat, 6 May 2023 18:24:29 +0800 Subject: [PATCH 2/2] feat: support test case property --- testdata/cubic.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/testdata/cubic.xml b/testdata/cubic.xml index 3dad3b8..33dd571 100644 --- a/testdata/cubic.xml +++ b/testdata/cubic.xml @@ -66,12 +66,12 @@ type="" > - - - - - + + + + + STDOUT text