mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-04-06 13:38:07 -05:00
parent
cce73b4996
commit
15422cf504
@ -642,6 +642,46 @@ var testCases = []TestCase{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "18-coverpkg.txt",
|
||||||
|
reportName: "18-report.xml",
|
||||||
|
report: &parser.Report{
|
||||||
|
Packages: []parser.Package{
|
||||||
|
{
|
||||||
|
Name: "package1/foo",
|
||||||
|
Time: 400,
|
||||||
|
Tests: []*parser.Test{
|
||||||
|
{
|
||||||
|
Name: "TestA",
|
||||||
|
Time: 100,
|
||||||
|
Result: parser.PASS,
|
||||||
|
Output: []string{},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "TestB",
|
||||||
|
Time: 300,
|
||||||
|
Result: parser.PASS,
|
||||||
|
Output: []string{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
CoveragePct: "10.0",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "package2/bar",
|
||||||
|
Time: 4200,
|
||||||
|
Tests: []*parser.Test{
|
||||||
|
{
|
||||||
|
Name: "TestC",
|
||||||
|
Time: 4200,
|
||||||
|
Result: parser.PASS,
|
||||||
|
Output: []string{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
CoveragePct: "99.8",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestParser(t *testing.T) {
|
func TestParser(t *testing.T) {
|
||||||
|
@ -41,8 +41,8 @@ type Test struct {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
regexStatus = regexp.MustCompile(`^\s*--- (PASS|FAIL|SKIP): (.+) \((\d+\.\d+)(?: seconds|s)\)$`)
|
regexStatus = regexp.MustCompile(`^\s*--- (PASS|FAIL|SKIP): (.+) \((\d+\.\d+)(?: seconds|s)\)$`)
|
||||||
regexCoverage = regexp.MustCompile(`^coverage:\s+(\d+\.\d+)%\s+of\s+statements$`)
|
regexCoverage = regexp.MustCompile(`^coverage:\s+(\d+\.\d+)%\s+of\s+statements(?:\sin\s.+)?$`)
|
||||||
regexResult = regexp.MustCompile(`^(ok|FAIL)\s+([^ ]+)\s+(?:(\d+\.\d+)s|(\[\w+ failed]))(?:\s+coverage:\s+(\d+\.\d+)%\sof\sstatements)?$`)
|
regexResult = regexp.MustCompile(`^(ok|FAIL)\s+([^ ]+)\s+(?:(\d+\.\d+)s|(\[\w+ failed]))(?:\s+coverage:\s+(\d+\.\d+)%\sof\sstatements(?:\sin\s.+)?)?$`)
|
||||||
regexOutput = regexp.MustCompile(`( )*\t(.*)`)
|
regexOutput = regexp.MustCompile(`( )*\t(.*)`)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
12
tests/18-coverpkg.txt
Normal file
12
tests/18-coverpkg.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
=== RUN TestA
|
||||||
|
--- PASS: TestA (0.10 seconds)
|
||||||
|
=== RUN TestB
|
||||||
|
--- PASS: TestB (0.30 seconds)
|
||||||
|
PASS
|
||||||
|
coverage: 10% of statements in fmt, encoding/xml
|
||||||
|
ok package1/foo 0.400s coverage: 10.0% of statements in fmt, encoding/xml
|
||||||
|
=== RUN TestC
|
||||||
|
--- PASS: TestC (4.20 seconds)
|
||||||
|
PASS
|
||||||
|
coverage: 99.8% of statements in fmt, encoding/xml
|
||||||
|
ok package2/bar 4.200s coverage: 99.8% of statements in fmt, encoding/xml
|
18
tests/18-report.xml
Normal file
18
tests/18-report.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite tests="2" failures="0" time="0.400" name="package1/foo">
|
||||||
|
<properties>
|
||||||
|
<property name="go.version" value="1.0"></property>
|
||||||
|
<property name="coverage.statements.pct" value="10.0"></property>
|
||||||
|
</properties>
|
||||||
|
<testcase classname="foo" name="TestA" time="0.100"></testcase>
|
||||||
|
<testcase classname="foo" name="TestB" time="0.300"></testcase>
|
||||||
|
</testsuite>
|
||||||
|
<testsuite tests="1" failures="0" time="4.200" name="package2/bar">
|
||||||
|
<properties>
|
||||||
|
<property name="go.version" value="1.0"></property>
|
||||||
|
<property name="coverage.statements.pct" value="99.8"></property>
|
||||||
|
</properties>
|
||||||
|
<testcase classname="bar" name="TestC" time="4.200"></testcase>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
Loading…
x
Reference in New Issue
Block a user