mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-04-05 21:18:08 -05:00
add test for compiled test
This commit is contained in:
parent
27383b3a74
commit
4f0ad507d0
@ -15,6 +15,7 @@ type TestCase struct {
|
|||||||
reportName string
|
reportName string
|
||||||
report *Report
|
report *Report
|
||||||
noXmlHeader bool
|
noXmlHeader bool
|
||||||
|
packageName string
|
||||||
}
|
}
|
||||||
|
|
||||||
var testCases []TestCase = []TestCase{
|
var testCases []TestCase = []TestCase{
|
||||||
@ -156,6 +157,34 @@ var testCases []TestCase = []TestCase{
|
|||||||
},
|
},
|
||||||
noXmlHeader: true,
|
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) {
|
func TestParser(t *testing.T) {
|
||||||
@ -165,7 +194,7 @@ func TestParser(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
report, err := Parse(file)
|
report, err := Parse(file, testCase.packageName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("error parsing: %s", err)
|
t.Fatalf("error parsing: %s", err)
|
||||||
}
|
}
|
||||||
|
5
tests/07-compiled_test.txt
Normal file
5
tests/07-compiled_test.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
=== RUN TestOne
|
||||||
|
--- PASS: TestOne (0.06s)
|
||||||
|
=== RUN TestTwo
|
||||||
|
--- PASS: TestTwo (0.10s)
|
||||||
|
PASS
|
8
tests/07-report.xml
Normal file
8
tests/07-report.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<testsuite tests="2" failures="0" time="0.160" name="test/package">
|
||||||
|
<properties>
|
||||||
|
<property name="go.version" value="1.0"></property>
|
||||||
|
</properties>
|
||||||
|
<testcase classname="package" name="TestOne" time="0.060"></testcase>
|
||||||
|
<testcase classname="package" name="TestTwo" time="0.100"></testcase>
|
||||||
|
</testsuite>
|
Loading…
x
Reference in New Issue
Block a user