@@ -14,55 +14,53 @@ class JUnitXmlReporter(tasksAndEvents: ListBuffer[(String, ListBuffer[Event])])
14
14
def result : Elem =
15
15
XML .loadString(s """ <testsuites>
16
16
${(for ((name, events) <- tasksAndEvents)
17
- yield
18
- s """ <testsuite
17
+ yield s """ <testsuite
19
18
hostname=""
20
19
name=" ${escape(name)}"
21
20
tests=" ${events.size.toString}"
22
21
errors=" ${events.count(_.status == Error ).toString}"
23
22
failures=" ${events.count(_.status == Failure ).toString}"
24
23
skipped=" ${events
25
- .count(e => e.status == Ignored || e.status == Skipped || e.status == Pending || e.status == Canceled )
26
- .toString}"
24
+ .count(e => e.status == Ignored || e.status == Skipped || e.status == Pending || e.status == Canceled )
25
+ .toString}"
27
26
time=" ${(events.map(_.duration).sum / 1000d ).toString}">
28
27
${(for (e <- events)
29
- yield
30
- s """ <testcase
28
+ yield s """ <testcase
31
29
classname=" ${escape(name)}"
32
30
name=" ${e.selector match {
33
- case selector : TestSelector => escape(selector.testName.split('.' ).last)
34
- case _ => " Error occurred outside of a test case."
35
- }}"
31
+ case selector : TestSelector => escape(selector.testName.split('.' ).last)
32
+ case _ => " Error occurred outside of a test case."
33
+ }}"
36
34
time=" ${(e.duration / 1000d ).toString}">
37
35
${
38
- val stringWriter = new StringWriter ()
39
- if (e.throwable.isDefined) {
40
- val writer = new PrintWriter (stringWriter)
41
- e.throwable.get.printStackTrace(writer)
42
- writer.flush()
43
- }
44
- val trace : String = stringWriter.toString
45
- e.status match {
46
- case Status .Error if e.throwable.isDefined =>
47
- val t = e.throwable.get
48
- s """ <error message=" ${escape(t.getMessage)}" type=" ${escape(t.getClass.getName)}"> ${escape(trace)}</error> """
49
- case Status .Error =>
50
- s """ <error message="No Exception or message provided"/> """
51
- case Status .Failure if e.throwable.isDefined =>
52
- val t = e.throwable.get
53
- s """ <failure message=" ${escape(t.getMessage)}" type=" ${escape(t.getClass.getName)}"> ${escape(trace)}</failure> """
54
- case Status .Failure =>
55
- s """ <failure message="No Exception or message provided"/> """
56
- case Status .Canceled if e.throwable.isDefined =>
57
- val t = e.throwable.get
58
- s """ <skipped message=" ${escape(t.getMessage)}" type=" ${escape(t.getClass.getName)}"> ${escape(trace)}</skipped> """
59
- case Status .Canceled =>
60
- s """ <skipped message="No Exception or message provided"/> """
61
- case Status .Ignored | Status .Skipped | Status .Pending =>
62
- " <skipped/>"
63
- case _ =>
64
- }
65
- }
36
+ val stringWriter = new StringWriter ()
37
+ if (e.throwable.isDefined) {
38
+ val writer = new PrintWriter (stringWriter)
39
+ e.throwable.get.printStackTrace(writer)
40
+ writer.flush()
41
+ }
42
+ val trace : String = stringWriter.toString
43
+ e.status match {
44
+ case Status .Error if e.throwable.isDefined =>
45
+ val t = e.throwable.get
46
+ s """ <error message=" ${escape(t.getMessage)}" type=" ${escape(t.getClass.getName)}"> ${escape(trace)}</error> """
47
+ case Status .Error =>
48
+ s """ <error message="No Exception or message provided"/> """
49
+ case Status .Failure if e.throwable.isDefined =>
50
+ val t = e.throwable.get
51
+ s """ <failure message=" ${escape(t.getMessage)}" type=" ${escape(t.getClass.getName)}"> ${escape(trace)}</failure> """
52
+ case Status .Failure =>
53
+ s """ <failure message="No Exception or message provided"/> """
54
+ case Status .Canceled if e.throwable.isDefined =>
55
+ val t = e.throwable.get
56
+ s """ <skipped message=" ${escape(t.getMessage)}" type=" ${escape(t.getClass.getName)}"> ${escape(trace)}</skipped> """
57
+ case Status .Canceled =>
58
+ s """ <skipped message="No Exception or message provided"/> """
59
+ case Status .Ignored | Status .Skipped | Status .Pending =>
60
+ " <skipped/>"
61
+ case _ =>
62
+ }
63
+ }
66
64
</testcase> """ ).mkString(" " )}
67
65
<system-out><![CDATA[]]></system-out>
68
66
<system-err><![CDATA[]]></system-err>
0 commit comments