Skip to content

Commit 8a1d353

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. Add a hidden flag (--xunit-message-failure) that will update the XML output to dipslay the result output instead of static "failure" message.
1 parent 11ebe9e commit 8a1d353

File tree

15 files changed

+400
-9
lines changed

15 files changed

+400
-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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
targets: [
9+
.testTarget(
10+
name: "TestMultipleFailureSwiftTestingTests",
11+
),
12+
]
13+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import Testing
2+
3+
@Test func testFailure1() async throws {
4+
#expect(Bool(false), "ST Test failure 1")
5+
}
6+
7+
@Test func testFailure2() async throws {
8+
#expect(Bool(false), "ST Test failure 2")
9+
}
10+
11+
@Test func testFailure3() async throws {
12+
#expect(Bool(false), "ST Test failure 3")
13+
}
14+
15+
@Test func testFailure4() async throws {
16+
#expect(Bool(false), "ST Test failure 4")
17+
}
18+
19+
@Test func testFailure5() async throws {
20+
#expect(Bool(false), "ST Test failure 5")
21+
}
22+
23+
@Test func testFailure6() async throws {
24+
#expect(Bool(false), "ST Test failure 6")
25+
}
26+
27+
@Test func testFailure7() async throws {
28+
#expect(Bool(false), "ST Test failure 7")
29+
}
30+
31+
@Test func testFailure8() async throws {
32+
#expect(Bool(false), "ST Test failure 8")
33+
}
34+
35+
@Test func testFailure9() async throws {
36+
#expect(Bool(false), "ST Test failure 9")
37+
}
38+
39+
@Test func testFailure10() async throws {
40+
#expect(Bool(false), "ST Test failure 10")
41+
}
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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
targets: [
9+
.testTarget(
10+
name: "TestMultipleFailureXCTestTests",
11+
),
12+
]
13+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import XCTest
2+
3+
final class TestMultipleFailureXCTestTests: XCTestCase {
4+
func testFailure1() throws {
5+
XCTAssertFalse(true, "Test failure 1")
6+
}
7+
8+
func testFailure2() throws {
9+
XCTAssertFalse(true, "Test failure 2")
10+
}
11+
12+
func testFailure3() throws {
13+
XCTAssertFalse(true, "Test failure 3")
14+
}
15+
16+
func testFailure4() throws {
17+
XCTAssertFalse(true, "Test failure 4")
18+
}
19+
20+
func testFailure5() throws {
21+
XCTAssertFalse(true, "Test failure 5")
22+
}
23+
24+
func testFailure6() throws {
25+
XCTAssertFalse(true, "Test failure 6")
26+
}
27+
28+
func testFailure7() throws {
29+
XCTAssertFalse(true, "Test failure 7")
30+
}
31+
32+
func testFailure8() throws {
33+
XCTAssertFalse(true, "Test failure 8")
34+
}
35+
36+
func testFailure9() throws {
37+
XCTAssertFalse(true, "Test failure 9")
38+
}
39+
40+
func testFailure10() throws {
41+
XCTAssertFalse(true, "Test failure 10")
42+
}
43+
44+
}
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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
targets: [
9+
.testTarget(
10+
name: "TestFailuresSwiftTestingTests",
11+
)
12+
]
13+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Testing
2+
3+
@Test func example() async throws {
4+
#expect(Bool(false), "Purposely failing & validating XML espace \"'<>")
5+
}
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

0 commit comments

Comments
 (0)