mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-04-05 05:00:15 -05:00
Add a test case which has more than one suite in it.
This commit is contained in:
parent
6d2ab46d4f
commit
fc2896020a
@ -156,10 +156,62 @@ var testCases []TestCase = []TestCase{
|
||||
},
|
||||
noXmlHeader: true,
|
||||
},
|
||||
{
|
||||
name: "06-mixed.txt",
|
||||
reportName: "06-report.xml",
|
||||
report: &Report{
|
||||
Packages: []Package{
|
||||
{
|
||||
Name: "package/name1",
|
||||
Time: 160,
|
||||
Tests: []Test{
|
||||
{
|
||||
Name: "TestOne",
|
||||
Time: 60,
|
||||
Result: PASS,
|
||||
Output: []string{},
|
||||
},
|
||||
{
|
||||
Name: "TestTwo",
|
||||
Time: 100,
|
||||
Result: PASS,
|
||||
Output: []string{},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "package/name2",
|
||||
Time: 151,
|
||||
Tests: []Test{
|
||||
{
|
||||
Name: "TestOne",
|
||||
Time: 20,
|
||||
Result: FAIL,
|
||||
Output: []string{
|
||||
"file_test.go:11: Error message",
|
||||
"file_test.go:11: Longer",
|
||||
"\terror",
|
||||
"\tmessage.",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "TestTwo",
|
||||
Time: 130,
|
||||
Result: PASS,
|
||||
Output: []string{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
noXmlHeader: true,
|
||||
},
|
||||
}
|
||||
|
||||
func TestParser(t *testing.T) {
|
||||
for _, testCase := range testCases {
|
||||
t.Logf("Running: %s", testCase.name)
|
||||
|
||||
file, err := os.Open("tests/" + testCase.name)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
17
tests/06-mixed.txt
Normal file
17
tests/06-mixed.txt
Normal file
@ -0,0 +1,17 @@
|
||||
=== RUN TestOne
|
||||
--- PASS: TestOne (0.06 seconds)
|
||||
=== RUN TestTwo
|
||||
--- PASS: TestTwo (0.10 seconds)
|
||||
PASS
|
||||
ok package/name1 0.160s
|
||||
=== RUN TestOne
|
||||
--- FAIL: TestOne (0.02 seconds)
|
||||
file_test.go:11: Error message
|
||||
file_test.go:11: Longer
|
||||
error
|
||||
message.
|
||||
=== RUN TestTwo
|
||||
--- PASS: TestTwo (0.13 seconds)
|
||||
FAIL
|
||||
exit status 1
|
||||
FAIL package/name2 0.151s
|
18
tests/06-report.xml
Normal file
18
tests/06-report.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<testsuites>
|
||||
<testsuite tests="2" failures="0" time="0.160" name="package/name1">
|
||||
<properties>
|
||||
<property name="go.version" value="go1.2.2"></property>
|
||||
</properties>
|
||||
<testcase classname="name1" name="TestOne" time="0.060"></testcase>
|
||||
<testcase classname="name1" name="TestTwo" time="0.100"></testcase>
|
||||
</testsuite>
|
||||
<testsuite tests="2" failures="1" time="0.151" name="package/name2">
|
||||
<properties>
|
||||
<property name="go.version" value="go1.2.2"></property>
|
||||
</properties>
|
||||
<testcase classname="name2" name="TestOne" time="0.020">
|
||||
<failure message="Failed" type="">file_test.go:11: Error message
file_test.go:11: Longer
	error
	message.</failure>
|
||||
</testcase>
|
||||
<testcase classname="name2" name="TestTwo" time="0.130"></testcase>
|
||||
</testsuite>
|
||||
</testsuites>
|
Loading…
x
Reference in New Issue
Block a user