@@ -258,19 +258,11 @@ public struct JunitXML: XmlSerializable {
258258 ) : group. testSuiteXML ( numFormatter: numFormatter)
259259
260260 for thisTest in tests {
261- let testcase = thisTest. xmlNode (
261+ let testcase = createTestCase (
262+ test: thisTest,
262263 classname: group. nameString,
263- numFormatter: numFormatter,
264- format: testReportFormat,
265- nodeNames: nodeNames
264+ failureSummaries: failureSummaries
266265 )
267- if thisTest. isFailed {
268- if let summary = thisTest. failureSummary ( in: failureSummaries) {
269- testcase. addChild ( summary. failureXML ( projectRoot: projectRoot) )
270- } else {
271- testcase. addChild ( failureWithoutSummary)
272- }
273- }
274266 node. addChild ( testcase)
275267 }
276268 return node
@@ -281,26 +273,37 @@ public struct JunitXML: XmlSerializable {
281273 ) -> [ XMLElement ] {
282274 var combined = [ XMLElement] ( )
283275 for thisTest in tests {
284- let testcase = thisTest. xmlNode (
276+ let testcase = createTestCase (
277+ test: thisTest,
285278 classname: name,
286- numFormatter: numFormatter,
287- format: testReportFormat,
288- nodeNames: nodeNames
279+ failureSummaries: failureSummaries
289280 )
290- if thisTest. isFailed {
291- if let summary = thisTest. failureSummary ( in: failureSummaries) {
292- testcase. addChild ( summary. failureXML ( projectRoot: projectRoot) )
293- } else {
294- testcase. addChild ( failureWithoutSummary)
295- }
296- } else if thisTest. isSkipped {
297- testcase. addChild ( skippedWithoutSummary)
298- }
299281 combined. append ( testcase)
300282 }
301283 return combined
302284 }
303285
286+ private func createTestCase(
287+ test: ActionTestMetadata , classname: String , failureSummaries: [ TestFailureIssueSummary ]
288+ ) -> XMLElement {
289+ let testcase = test. xmlNode (
290+ classname: classname,
291+ numFormatter: numFormatter,
292+ format: testReportFormat,
293+ nodeNames: nodeNames
294+ )
295+ if test. isFailed {
296+ if let summary = test. failureSummary ( in: failureSummaries) {
297+ testcase. addChild ( summary. failureXML ( projectRoot: projectRoot) )
298+ } else {
299+ testcase. addChild ( failureWithoutSummary)
300+ }
301+ } else if test. isSkipped {
302+ testcase. addChild ( skippedWithoutSummary)
303+ }
304+ return testcase
305+ }
306+
304307 private var failureWithoutSummary : XMLElement {
305308 return XMLElement ( name: " failure " )
306309 }
0 commit comments