Skip to content

Commit b8da895

Browse files
committed
Update xUnit to display output on failures (XCTest only)
For XCTest, the generated xUnit XML file is not helpful when tests fail as it contains the message "failure", which is redundant with the test results. Update the XML output to dipslay the result output instead of static "failure" message.
1 parent dca0cc2 commit b8da895

File tree

19 files changed

+441
-9
lines changed

19 files changed

+441
-9
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
xcuserdata/
5+
DerivedData/
6+
.swiftpm/configuration/registries.json
7+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
8+
.netrc
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// swift-tools-version: 6.0
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "TestMultipleFailureSwiftTesting",
8+
products: [
9+
// Products define the executables and libraries a package produces, making them visible to other packages.
10+
.library(
11+
name: "TestMultipleFailureSwiftTesting",
12+
targets: ["TestMultipleFailureSwiftTesting"]),
13+
],
14+
targets: [
15+
// Targets are the basic building blocks of a package, defining a module or a test suite.
16+
// Targets can depend on other targets in this package and products from dependencies.
17+
.target(
18+
name: "TestMultipleFailureSwiftTesting"),
19+
.testTarget(
20+
name: "TestMultipleFailureSwiftTestingTests",
21+
dependencies: ["TestMultipleFailureSwiftTesting"]
22+
),
23+
]
24+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// The Swift Programming Language
2+
// https://docs.swift.org/swift-book
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import Testing
2+
@testable import TestMultipleFailureSwiftTesting
3+
4+
@Test func testFailure1() async throws {
5+
#expect(Bool(false), "ST Test failure 1")
6+
}
7+
8+
@Test func testFailure2() async throws {
9+
#expect(Bool(false), "ST Test failure 2")
10+
}
11+
12+
@Test func testFailure3() async throws {
13+
#expect(Bool(false), "ST Test failure 3")
14+
}
15+
16+
@Test func testFailure4() async throws {
17+
#expect(Bool(false), "ST Test failure 4")
18+
}
19+
20+
@Test func testFailure5() async throws {
21+
#expect(Bool(false), "ST Test failure 5")
22+
}
23+
24+
@Test func testFailure6() async throws {
25+
#expect(Bool(false), "ST Test failure 6")
26+
}
27+
28+
@Test func testFailure7() async throws {
29+
#expect(Bool(false), "ST Test failure 7")
30+
}
31+
32+
@Test func testFailure8() async throws {
33+
#expect(Bool(false), "ST Test failure 8")
34+
}
35+
36+
@Test func testFailure9() async throws {
37+
#expect(Bool(false), "ST Test failure 9")
38+
}
39+
40+
@Test func testFailure10() async throws {
41+
#expect(Bool(false), "ST Test failure 10")
42+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.DS_Store
2+
/.build
3+
/Packages
4+
xcuserdata/
5+
DerivedData/
6+
.swiftpm/configuration/registries.json
7+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
8+
.netrc
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// swift-tools-version: 6.0
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "TestMultipleFailureXCTest",
8+
products: [
9+
// Products define the executables and libraries a package produces, making them visible to other packages.
10+
.library(
11+
name: "TestMultipleFailureXCTest",
12+
targets: ["TestMultipleFailureXCTest"]),
13+
],
14+
targets: [
15+
// Targets are the basic building blocks of a package, defining a module or a test suite.
16+
// Targets can depend on other targets in this package and products from dependencies.
17+
.target(
18+
name: "TestMultipleFailureXCTest"),
19+
.testTarget(
20+
name: "TestMultipleFailureXCTestTests",
21+
dependencies: ["TestMultipleFailureXCTest"]
22+
),
23+
]
24+
)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// The Swift Programming Language
2+
// https://docs.swift.org/swift-book
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import XCTest
2+
@testable import TestMultipleFailureXCTest
3+
4+
final class TestMultipleFailureXCTestTests: XCTestCase {
5+
func testFailure1() throws {
6+
XCTAssertFalse(true, "Test failure 1")
7+
}
8+
9+
func testFailure2() throws {
10+
XCTAssertFalse(true, "Test failure 2")
11+
}
12+
13+
func testFailure3() throws {
14+
XCTAssertFalse(true, "Test failure 3")
15+
}
16+
17+
func testFailure4() throws {
18+
XCTAssertFalse(true, "Test failure 4")
19+
}
20+
21+
func testFailure5() throws {
22+
XCTAssertFalse(true, "Test failure 5")
23+
}
24+
25+
func testFailure6() throws {
26+
XCTAssertFalse(true, "Test failure 6")
27+
}
28+
29+
func testFailure7() throws {
30+
XCTAssertFalse(true, "Test failure 7")
31+
}
32+
33+
func testFailure8() throws {
34+
XCTAssertFalse(true, "Test failure 8")
35+
}
36+
37+
func testFailure9() throws {
38+
XCTAssertFalse(true, "Test failure 9")
39+
}
40+
41+
func testFailure10() throws {
42+
XCTAssertFalse(true, "Test failure 10")
43+
}
44+
45+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.DS_Store
2+
/.build
3+
/.index-build
4+
/Packages
5+
xcuserdata/
6+
DerivedData/
7+
.swiftpm/configuration/registries.json
8+
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
9+
.netrc
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// swift-tools-version: 5.9
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "TestFailuresSwiftTesting",
8+
products: [
9+
// Products define the executables and libraries a package produces, making them visible to other packages.
10+
.library(
11+
name: "TestFailuresSwiftTesting",
12+
targets: ["TestFailuresSwiftTesting"])
13+
],
14+
targets: [
15+
// Targets are the basic building blocks of a package, defining a module or a test suite.
16+
// Targets can depend on other targets in this package and products from dependencies.
17+
.target(
18+
name: "TestFailuresSwiftTesting"),
19+
.testTarget(
20+
name: "TestFailuresSwiftTestingTests",
21+
dependencies: ["TestFailuresSwiftTesting"]
22+
)
23+
]
24+
)

0 commit comments

Comments
 (0)