Skip to content

Commit e3386e6

Browse files
committed
format xml output
1 parent bea949f commit e3386e6

5 files changed

+28
-10
lines changed

pkg/connectivity/junit.go

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func PrintJUnitResults(filename string, summary *Summary) {
3030
func printJunit(w io.Writer, summary *Summary) error {
3131
s := summaryToJunit(summary)
3232
enc := xml.NewEncoder(w)
33+
enc.Indent("", " ")
3334
return enc.Encode(s)
3435
}
3536

pkg/connectivity/result.go

+10-7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ func (r *Result) Features() map[string][]string {
3131
return r.TestCase.GetFeatures()
3232
}
3333

34+
func (r *Result) Passed(ignoreLoopback bool) bool {
35+
for _, step := range r.Steps {
36+
if step.LastComparison().ValueCounts(ignoreLoopback)[DifferentComparison] > 0 {
37+
return false
38+
}
39+
}
40+
return true
41+
}
42+
3443
type CombinedResults struct {
3544
Results []*Result
3645
}
@@ -60,13 +69,7 @@ func (c *CombinedResults) Summary(ignoreLoopback bool) *Summary {
6069
passedTotal, failedTotal := 0, 0
6170

6271
for testNumber, result := range c.Results {
63-
// preprocess to figure out whether it passed or failed
64-
passed := true
65-
for _, step := range result.Steps {
66-
if step.LastComparison().ValueCounts(ignoreLoopback)[DifferentComparison] > 0 {
67-
passed = false
68-
}
69-
}
72+
passed := result.Passed(ignoreLoopback)
7073

7174
for primary, subs := range result.Features() {
7275
if _, ok := summary.FeatureCounts[primary]; !ok {
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
<testsuite tests="0" failures="0" time="" name="cyclonus"><properties></properties><testcase classname="" name="test1" time=""></testcase><testcase classname="" name="test2 with spaces" time=""><failure message="" type=""></failure></testcase><testcase classname="" name="test3 with + special %chars/" time=""></testcase><testcase classname="" name="test4 with&#xA;newlines" time=""><failure message="" type=""></failure></testcase></testsuite>
1+
<testsuite tests="0" failures="0" time="" name="cyclonus">
2+
<properties></properties>
3+
<testcase classname="" name="test1" time=""></testcase>
4+
<testcase classname="" name="test2 with spaces" time="">
5+
<failure message="" type=""></failure>
6+
</testcase>
7+
<testcase classname="" name="test3 with + special %chars/" time=""></testcase>
8+
<testcase classname="" name="test4 with&#xA;newlines" time="">
9+
<failure message="" type=""></failure>
10+
</testcase>
11+
</testsuite>
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
<testsuite tests="0" failures="0" time="" name="cyclonus"><properties></properties></testsuite>
1+
<testsuite tests="0" failures="0" time="" name="cyclonus">
2+
<properties></properties>
3+
</testsuite>
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
<testsuite tests="0" failures="10" time="" name="cyclonus"><properties></properties></testsuite>
1+
<testsuite tests="0" failures="10" time="" name="cyclonus">
2+
<properties></properties>
3+
</testsuite>

0 commit comments

Comments
 (0)