diff --git a/go-junit-report_test.go b/go-junit-report_test.go index c268f0a..d1817be 100644 --- a/go-junit-report_test.go +++ b/go-junit-report_test.go @@ -15,6 +15,7 @@ type TestCase struct { reportName string report *Report noXmlHeader bool + packageName string } var testCases []TestCase = []TestCase{ @@ -156,6 +157,34 @@ var testCases []TestCase = []TestCase{ }, noXmlHeader: true, }, + + { + name: "07-compiled_test.txt", + reportName: "07-report.xml", + report: &Report{ + Packages: []Package{ + { + Name: "test/package", + Time: 160, + Tests: []Test{ + { + Name: "TestOne", + Time: 60, + Result: PASS, + Output: []string{}, + }, + { + Name: "TestTwo", + Time: 100, + Result: PASS, + Output: []string{}, + }, + }, + }, + }, + }, + packageName: "test/package", + }, } func TestParser(t *testing.T) { @@ -165,7 +194,7 @@ func TestParser(t *testing.T) { t.Fatal(err) } - report, err := Parse(file) + report, err := Parse(file, testCase.packageName) if err != nil { t.Fatalf("error parsing: %s", err) } diff --git a/tests/07-compiled_test.txt b/tests/07-compiled_test.txt new file mode 100644 index 0000000..dab2759 --- /dev/null +++ b/tests/07-compiled_test.txt @@ -0,0 +1,5 @@ +=== RUN TestOne +--- PASS: TestOne (0.06s) +=== RUN TestTwo +--- PASS: TestTwo (0.10s) +PASS \ No newline at end of file diff --git a/tests/07-report.xml b/tests/07-report.xml new file mode 100644 index 0000000..af2fa08 --- /dev/null +++ b/tests/07-report.xml @@ -0,0 +1,8 @@ + + + + + + + +