Repository: cpisciotta/xcbeautify
Pull request #237 (2024-01-14 03:34:37)

Delete TestSummary
## Changes

Delete custom `TestSummary` logic. Instead, parse and use the output given by `xcodebuild`. This'll significantly simplify xcbeautify's codebase, give users more information, and more closely match `xcodebuild`'s raw output. 

## Testing

### Test 1

> swift build && swift test | ./.build/debug/xcbeautify --disable-colored-output > filename.txt

| | Old | New |
|:---:|:---:|:---:|
| Run 1 - Time | 19.24 seconds  | 12.67 seconds |
| Run 1 - Log | [old1.txt](https://github.com/user-attachments/files/16420420/old1.txt) | [new1.txt](https://github.com/user-attachments/files/16420408/new1.txt) |
| Run 2 - Time | 12.48 seconds | 12.85 seconds |
| Run 2 - Log | [old2.txt](https://github.com/user-attachments/files/16420425/old2.txt) | [new2.txt](https://github.com/user-attachments/files/16420409/new2.txt) |
| Run 3 - Time | 12.86 | 12.93 seconds |
| Run 3 - Log | [old3.txt](https://github.com/user-attachments/files/16420428/old3.txt) | [new3.txt](https://github.com/user-attachments/files/16420410/new3.txt) |

### Test 2

> make measure

| | Old | New |
|:---:|:---:|:---:|
| Run 1 | 4.74 seconds | 4.91 seconds |
| Run 2 | 4.76 seconds | 4.71 seconds |
| Run 3 | 4.78 seconds | 4.73 seconds |

## Example Output

### Old

```
TerminalRendererTests
    ✔ testAggregateTarget (0.000 seconds)
    ...
    ✔ testXcodeprojError (0.000 seconds)
    ✔ testXcodeprojWarning (0.000 seconds)
Tests Passed: 0 failed, 0 skipped, 306 total (12.477 seconds)
```

### New

```
TerminalRendererTests
    ✔ testAggregateTarget (0.000 seconds)
    ...
    ✔ testXcodeprojError (0.000 seconds)
    ✔ testXcodeprojWarning (0.000 seconds)
Executed 99 tests, with 0 failures (0 unexpected) in 0.014 (0.015) seconds
Test Suite 'xcbeautifyPackageTests.xctest' passed at 2024-07-29 20:38:00.325.
Executed 306 tests, with 0 failures (0 unexpected) in 12.355 (12.360) seconds
Test Suite 'All tests' passed at 2024-07-29 20:38:00.325.
Executed 306 tests, with 0 failures (0 unexpected) in 12.355 (12.361) seconds
```

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/cpisciotta/xcbeautify/pull/237?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Comparison is base [(`43823ca`)](https://app.codecov.io/gh/cpisciotta/xcbeautify/commit/43823cac79d0ba7c061de279a5f3b0ee6c96276a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta) 84.90% compared to head [(`9585694`)](https://app.codecov.io/gh/cpisciotta/xcbeautify/pull/237?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta) 80.41%.


<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             main     #237      +/-   ##
==========================================
- Coverage   84.90%   80.41%   -4.50%     
==========================================
  Files          14       13       -1     
  Lines        1862     1787      -75     
==========================================
- Hits         1581     1437     -144     
- Misses        281      350      +69     
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/cpisciotta/xcbeautify/pull/237?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Charles+Pisciotta).


Patch:
diff --git a/Sources/XcbeautifyLib/CaptureGroups.swift b/Sources/XcbeautifyLib/CaptureGroups.swift
index 4d86b5f..320fe2d 100644
--- a/Sources/XcbeautifyLib/CaptureGroups.swift
+++ b/Sources/XcbeautifyLib/CaptureGroups.swift
@@ -436,15 +436,16 @@ struct CpresourceCaptureGroup: CopyCaptureGroup {
 }
 
 struct ExecutedWithoutSkippedCaptureGroup: ExecutedCaptureGroup {
-    static let outputType: OutputType = .task
+    static let outputType: OutputType = .result
 
     /// Regular expression captured groups:
     /// $1 = number of tests
     /// $2 = number of failures
     /// $3 = number of unexpected failures
     /// $4 = wall clock time in seconds (e.g. 0.295)
-    static let regex = Regex(pattern: #"^\s*Executed\s(\d+)\stest[s]?,\swith\s(\d+)\sfailure[s]?\s\((\d+)\sunexpected\)\sin\s\d+\.\d{3}\s\((\d+\.\d{3})\)\sseconds"#)
+    static let regex = Regex(pattern: #"^\s*(Executed\s(\d+)\stest[s]?,\swith\s(\d+)\sfailure[s]?\s\((\d+)\sunexpected\)\sin\s\d+\.\d{3}\s\((\d+\.\d{3})\)\sseconds.*)$"#)
 
+    let wholeResult: String
     let numberOfTests: Int
     let numberOfSkipped = 0
     let numberOfFailures: Int
@@ -452,9 +453,10 @@ struct ExecutedWithoutSkippedCaptureGroup: ExecutedCaptureGroup {
     let wallClockTimeInSeconds: Double
 
     init?(groups: [String]) {
-        assert(groups.count >= 4)
-        guard let _numberOfTests = groups[safe: 0], let _numberOfFailures = groups[safe: 1], let _numberOfUnexpectedFailures = groups[safe: 2], let _wallClockTimeInSeconds = groups[safe: 3] else { return nil }
+        assert(groups.count == 5)
+        guard let wholeResult = groups[safe: 0], let _numberOfTests = groups[safe: 1], let _numberOfFailures = groups[safe: 2], let _numberOfUnexpectedFailures = groups[safe: 3], let _wallClockTimeInSeconds = groups[safe: 4] else { return nil }
         guard let numberOfTests = Int(_numberOfTests), let numberOfFailures = Int(_numberOfFailures), let numberOfUnexpectedFailures = Int(_numberOfUnexpectedFailures), let wallClockTimeInSeconds = Double(_wallClockTimeInSeconds) else { return nil }
+        self.wholeResult = wholeResult
         self.numberOfTests = numberOfTests
         self.numberOfFailures = numberOfFailures
         self.numberOfUnexpectedFailures = numberOfUnexpectedFailures
@@ -463,7 +465,7 @@ struct ExecutedWithoutSkippedCaptureGroup: ExecutedCaptureGroup {
 }
 
 struct ExecutedWithSkippedCaptureGroup: ExecutedCaptureGroup {
-    static let outputType: OutputType = .task
+    static let outputType: OutputType = .result
 
     /// Regular expression captured groups:
     /// $1 = number of tests
@@ -471,8 +473,9 @@ struct ExecutedWithSkippedCaptureGroup: ExecutedCaptureGroup {
     /// $3 = number of failures
     /// $4 = number of unexpected failures
     /// $5 = wall clock time in seconds (e.g. 0.295)
-    static let regex = Regex(pattern: #"^\s*Executed\s(\d+)\stest[s]?,\swith\s(\d+)\stest[s]?\sskipped\sand\s(\d+)\sfailure[s]?\s\((\d+)\sunexpected\)\sin\s\d+\.\d{3}\s\((\d+\.\d{3})\)\sseconds"#)
+    static let regex = Regex(pattern: #"^\s*(Executed\s(\d+)\stest[s]?,\swith\s(\d+)\stest[s]?\sskipped\sand\s(\d+)\sfailure[s]?\s\((\d+)\sunexpected\)\sin\s\d+\.\d{3}\s\((\d+\.\d{3})\)\sseconds.*)$"#)
 
+    let wholeResult: String
     let numberOfTests: Int
     let numberOfSkipped: Int
     let numberOfFailures: Int
@@ -480,9 +483,10 @@ struct ExecutedWithSkippedCaptureGroup: ExecutedCaptureGroup {
     let wallClockTimeInSeconds: Double
 
     init?(groups: [String]) {
-        assert(groups.count >= 5)
-        guard let _numberOfTests = groups[safe: 0], let _numberOfSkipped = groups[safe: 1], let _numberOfFailures = groups[safe: 2], let _numberOfUnexpectedFailures = groups[safe: 3], let _wallClockTimeInSeconds = groups[safe: 4] else { return nil }
+        assert(groups.count == 6)
+        guard let wholeResult = groups[safe: 0], let _numberOfTests = groups[safe: 1], let _numberOfSkipped = groups[safe: 2], let _numberOfFailures = groups[safe: 3], let _numberOfUnexpectedFailures = groups[safe: 4], let _wallClockTimeInSeconds = groups[safe: 5] else { return nil }
         guard let numberOfTests = Int(_numberOfTests), let numberOfSkipped = Int(_numberOfSkipped), let numberOfFailures = Int(_numberOfFailures), let numberOfUnexpectedFailures = Int(_numberOfUnexpectedFailures), let wallClockTimeInSeconds = Double(_wallClockTimeInSeconds) else { return nil }
+        self.wholeResult = wholeResult
         self.numberOfTests = numberOfTests
         self.numberOfSkipped = numberOfSkipped
         self.numberOfFailures = numberOfFailures
@@ -1115,18 +1119,20 @@ struct TestsRunCompletionCaptureGroup: CaptureGroup {
     /// $2 = result
     /// $3 = time
     #if os(Linux)
-    static let regex = Regex(pattern: #"^\s*Test Suite '(.*)' (finished|passed|failed) at (.*)"#)
+    static let regex = Regex(pattern: #"^\s*(Test Suite '(.*)' (finished|passed|failed) at (.*).*)"#)
     #else
-    static let regex = Regex(pattern: #"^\s*Test Suite '(?:.*\/)?(.*[ox]ctest.*)' (finished|passed|failed) at (.*)"#)
+    static let regex = Regex(pattern: #"^\s*(Test Suite '(?:.*\/)?(.*[ox]ctest.*)' (finished|passed|failed) at (.*).*)"#)
     #endif
 
+    let wholeResult: String
     let suite: String
     let result: String
     let time: String
 
     init?(groups: [String]) {
-        assert(groups.count >= 3)
-        guard let suite = groups[safe: 0], let result = groups[safe: 1], let time = groups[safe: 2] else { return nil }
+        assert(groups.count >= 4)
+        guard let wholeResult = groups[safe: 0], let suite = groups[safe: 1], let result = groups[safe: 2], let time = groups[safe: 3] else { return nil }
+        self.wholeResult = wholeResult
         self.suite = suite
         self.result = result
         self.time = time
@@ -1174,25 +1180,27 @@ struct TestSuiteStartCaptureGroup: CaptureGroup {
 
 struct TestSuiteAllTestsPassedCaptureGroup: CaptureGroup {
     static let outputType: OutputType = .result
-    static let regex = Regex(pattern: #"^\s*Test Suite 'All tests' passed at"#)
+    static let regex = Regex(pattern: #"^\s*(Test Suite 'All tests' passed at.*)"#)
 
-    private init() { }
+    let wholeResult: String
 
     init?(groups: [String]) {
-        assert(groups.count >= 0)
-        self.init()
+        assert(groups.count == 1)
+        guard let wholeResult = groups[safe: 0] else { return nil }
+        self.wholeResult = wholeResult
     }
 }
 
 struct TestSuiteAllTestsFailedCaptureGroup: CaptureGroup {
     static let outputType: OutputType = .result
-    static let regex = Regex(pattern: #"^\s*Test Suite 'All tests' failed at"#)
+    static let regex = Regex(pattern: #"^\s*(Test Suite 'All tests' failed at.*)"#)
 
-    private init() { }
+    let wholeResult: String
 
     init?(groups: [String]) {
-        assert(groups.count >= 0)
-        self.init()
+        assert(groups.count == 1)
+        guard let wholeResult = groups[safe: 0] else { return nil }
+        self.wholeResult = wholeResult
     }
 }
 
diff --git a/Sources/XcbeautifyLib/Parser.swift b/Sources/XcbeautifyLib/Parser.swift
index 3d80d9c..9396ab2 100644
--- a/Sources/XcbeautifyLib/Parser.swift
+++ b/Sources/XcbeautifyLib/Parser.swift
@@ -5,10 +5,6 @@ package class Parser {
 
     private let additionalLines: () -> String?
 
-    private(set) var summary: TestSummary?
-
-    private(set) var needToRecordSummary = false
-
     private let preserveUnbeautifiedLines: Bool
 
     package private(set) var outputType = OutputType.undefined
@@ -100,6 +96,10 @@ package class Parser {
         PackageGraphResolvedItemCaptureGroup.self,
         DuplicateLocalizedStringKeyCaptureGroup.self,
         SwiftDriverJobDiscoveryEmittingModuleCaptureGroup.self,
+        ExecutedWithoutSkippedCaptureGroup.self,
+        ExecutedWithSkippedCaptureGroup.self,
+        TestSuiteAllTestsPassedCaptureGroup.self,
+        TestSuiteAllTestsFailedCaptureGroup.self,
     ]
 
     // MARK: - Init
@@ -135,28 +135,6 @@ package class Parser {
         guard let idx = captureGroupTypes.firstIndex(where: { $0.regex.match(string: line) }) else {
             // Some uncommon cases, which have additional logic and don't follow default flow
 
-            if ExecutedWithoutSkippedCaptureGroup.regex.match(string: line) {
-                outputType = ExecutedWithoutSkippedCaptureGroup.outputType
-                parseSummary(line: line, colored: colored, skipped: false)
-                return nil
-            }
-
-            if ExecutedWithSkippedCaptureGroup.regex.match(string: line) {
-                outputType = ExecutedWithSkippedCaptureGroup.outputType
-                parseSummary(line: line, colored: colored, skipped: true)
-                return nil
-            }
-
-            if TestSuiteAllTestsPassedCaptureGroup.regex.match(string: line) {
-                needToRecordSummary = true
-                return nil
-            }
-
-            if TestSuiteAllTestsFailedCaptureGroup.regex.match(string: line) {
-                needToRecordSummary = true
-                return nil
-            }
-
             // Nothing found?
             outputType = OutputType.undefined
             return preserveUnbeautifiedLines ? line : nil
@@ -179,27 +157,4 @@ package class Parser {
 
         return formattedOutput
     }
-
-    package func formattedSummary() -> String? {
-        guard let summary else { return nil }
-        return renderer.format(testSummary: summary)
-    }
-
-    // MARK: Private
-
-    private func parseSummary(line: String, colored: Bool, skipped: Bool) {
-        guard needToRecordSummary else { return }
-        defer { needToRecordSummary = false }
-
-        guard let _group: CaptureGroup = line.captureGroup(with: skipped ? ExecutedWithSkippedCaptureGroup.pattern : ExecutedWithoutSkippedCaptureGroup.pattern) else { return }
-        guard let group = _group as? ExecutedCaptureGroup else { return }
-
-        summary += TestSummary(
-            testsCount: group.numberOfTests,
-            skippedCount: group.numberOfSkipped,
-            failuresCount: group.numberOfFailures,
-            unexpectedCount: group.numberOfUnexpectedFailures,
-            time: group.wallClockTimeInSeconds
-        )
-    }
 }
diff --git a/Sources/XcbeautifyLib/Renderers/GitHubActionsRenderer.swift b/Sources/XcbeautifyLib/Renderers/GitHubActionsRenderer.swift
index 7e32fef..8d11e25 100644
--- a/Sources/XcbeautifyLib/Renderers/GitHubActionsRenderer.swift
+++ b/Sources/XcbeautifyLib/Renderers/GitHubActionsRenderer.swift
@@ -215,16 +215,6 @@ struct GitHubActionsRenderer: OutputRendering {
             message: warningMessage
         )
     }
-
-    func format(testSummary: TestSummary) -> String {
-        if testSummary.isSuccess() {
-            let message = "Tests Passed: \(testSummary.description)"
-            return outputGitHubActionsLog(annotationType: .notice, message: message)
-        } else {
-            let message = "Tests Failed: \(testSummary.description)"
-            return outputGitHubActionsLog(annotationType: .error, message: message)
-        }
-    }
 }
 
 private struct FileComponents {
diff --git a/Sources/XcbeautifyLib/Renderers/OutputRendering.swift b/Sources/XcbeautifyLib/Renderers/OutputRendering.swift
index ddd5178..52bd1bd 100644
--- a/Sources/XcbeautifyLib/Renderers/OutputRendering.swift
+++ b/Sources/XcbeautifyLib/Renderers/OutputRendering.swift
@@ -6,8 +6,6 @@ protocol OutputRendering {
 
     func beautify(line: String, pattern: String) -> String?
 
-    func format(testSummary: TestSummary) -> String
-
     func formatAnalyze(group: AnalyzeCaptureGroup) -> String
     func formatCheckDependencies() -> String
     func formatCleanRemove(group: CleanRemoveCaptureGroup) -> String
@@ -24,8 +22,8 @@ protocol OutputRendering {
     func formatCursor(group: CursorCaptureGroup) -> String?
     func formatDuplicateLocalizedStringKey(group: DuplicateLocalizedStringKeyCaptureGroup) -> String
     func formatError(group: ErrorCaptureGroup) -> String
-    func formatExecutedWithoutSkipped(group: ExecutedWithoutSkippedCaptureGroup) -> String?
-    func formatExecutedWithSkipped(group: ExecutedWithSkippedCaptureGroup) -> String?
+    func formatExecutedWithoutSkipped(group: ExecutedWithoutSkippedCaptureGroup) -> String
+    func formatExecutedWithSkipped(group: ExecutedWithSkippedCaptureGroup) -> String
     func formatFailingTest(group: FailingTestCaptureGroup) -> String
     func formatFileMissingError(group: FileMissingErrorCaptureGroup) -> String
     func formatGenerateCoverageData(group: GenerateCoverageDataCaptureGroup) -> String
@@ -66,9 +64,9 @@ protocol OutputRendering {
     func formatTestCaseSkipped(group: TestCaseSkippedCaptureGroup) -> String
     func formatTestCasePending(group: TestCasePendingCaptureGroup) -> String
     func formatTestCasesStarted(group: TestCaseStartedCaptureGroup) -> String?
-    func formatTestsRunCompletion(group: TestsRunCompletionCaptureGroup) -> String?
-    func formatTestSuiteAllTestsFailed(group: TestSuiteAllTestsFailedCaptureGroup) -> String?
-    func formatTestSuiteAllTestsPassed(group: TestSuiteAllTestsPassedCaptureGroup) -> String?
+    func formatTestsRunCompletion(group: TestsRunCompletionCaptureGroup) -> String
+    func formatTestSuiteAllTestsFailed(group: TestSuiteAllTestsFailedCaptureGroup) -> String
+    func formatTestSuiteAllTestsPassed(group: TestSuiteAllTestsPassedCaptureGroup) -> String
     func formatTestSuiteStart(group: TestSuiteStartCaptureGroup) -> String
     func formatTestSuiteStarted(group: TestSuiteStartedCaptureGroup) -> String
     func formatTIFFUtil(group: TIFFutilCaptureGroup) -> String?
@@ -337,12 +335,12 @@ extension OutputRendering {
         nil
     }
 
-    func formatExecutedWithoutSkipped(group: ExecutedWithoutSkippedCaptureGroup) -> String? {
-        nil
+    func formatExecutedWithoutSkipped(group: ExecutedWithoutSkippedCaptureGroup) -> String {
+        group.wholeResult
     }
 
-    func formatExecutedWithSkipped(group: ExecutedWithSkippedCaptureGroup) -> String? {
-        nil
+    func formatExecutedWithSkipped(group: ExecutedWithSkippedCaptureGroup) -> String {
+        group.wholeResult
     }
 
     func formatGenerateCoverageData(group: GenerateCoverageDataCaptureGroup) -> String {
@@ -492,16 +490,16 @@ extension OutputRendering {
         nil
     }
 
-    func formatTestsRunCompletion(group: TestsRunCompletionCaptureGroup) -> String? {
-        nil
+    func formatTestsRunCompletion(group: TestsRunCompletionCaptureGroup) -> String {
+        group.wholeResult
     }
 
-    func formatTestSuiteAllTestsFailed(group: TestSuiteAllTestsFailedCaptureGroup) -> String? {
-        nil
+    func formatTestSuiteAllTestsFailed(group: TestSuiteAllTestsFailedCaptureGroup) -> String {
+        group.wholeResult
     }
 
-    func formatTestSuiteAllTestsPassed(group: TestSuiteAllTestsPassedCaptureGroup) -> String? {
-        nil
+    func formatTestSuiteAllTestsPassed(group: TestSuiteAllTestsPassedCaptureGroup) -> String {
+        group.wholeResult
     }
 
     func formatTestSuiteStart(group: TestSuiteStartCaptureGroup) -> String {
@@ -741,12 +739,4 @@ extension OutputRendering {
     func formatParallelTestingFailed(group: ParallelTestingFailedCaptureGroup) -> String {
         colored ? group.wholeError.s.Bold.f.Red : group.wholeError
     }
-
-    func format(testSummary: TestSummary) -> String {
-        if testSummary.isSuccess() {
-            colored ? "Tests Passed: \(testSummary.description)".s.Bold.f.Green : "Tests Passed: \(testSummary.description)"
-        } else {
-            colored ? "Tests Failed: \(testSummary.description)".s.Bold.f.Red : "Tests Failed: \(testSummary.description)"
-        }
-    }
 }
diff --git a/Sources/xcbeautify/Xcbeautify.swift b/Sources/xcbeautify/Xcbeautify.swift
index c078948..09fee81 100644
--- a/Sources/xcbeautify/Xcbeautify.swift
+++ b/Sources/xcbeautify/Xcbeautify.swift
@@ -98,10 +98,6 @@ struct Xcbeautify: ParsableCommand {
             output.write(parser.outputType, formatted)
         }
 
-        if let formattedSummary = parser.formattedSummary() {
-            output.write(.result, formattedSummary)
-        }
-
         if !report.isEmpty {
             let outputPath = URL(
                 fileURLWithPath: reportPath,


Test patch:
diff --git a/Sources/XcbeautifyLib/TestSummary.swift b/Sources/XcbeautifyLib/TestSummary.swift
deleted file mode 100644
index b3beb18..0000000
--- a/Sources/XcbeautifyLib/TestSummary.swift
+++ /dev/null
@@ -1,33 +0,0 @@
-struct TestSummary {
-    let testsCount: Int
-    let skippedCount: Int
-    let failuresCount: Int
-    let unexpectedCount: Int
-    let time: Double
-
-    static func += (_left: inout TestSummary?, right: TestSummary) {
-        guard let left = _left else {
-            _left = right
-            return
-        }
-
-        _left = TestSummary(
-            testsCount: left.testsCount + right.testsCount,
-            skippedCount: left.skippedCount + right.skippedCount,
-            failuresCount: left.failuresCount + right.failuresCount,
-            unexpectedCount: left.unexpectedCount + right.unexpectedCount,
-            time: left.time + right.time
-        )
-    }
-}
-
-extension TestSummary {
-    func isSuccess() -> Bool {
-        failuresCount == 0
-    }
-
-    var description: String {
-        let timeFormatted = String(format: "%.3f", time)
-        return "\(failuresCount) failed, \(skippedCount) skipped, \(testsCount) total (\(timeFormatted) seconds)"
-    }
-}
diff --git a/Tests/XcbeautifyLibTests/RendererTests/GitHubActionsRendererTests.swift b/Tests/XcbeautifyLibTests/RendererTests/GitHubActionsRendererTests.swift
index 099c472..51b57ce 100644
--- a/Tests/XcbeautifyLibTests/RendererTests/GitHubActionsRendererTests.swift
+++ b/Tests/XcbeautifyLibTests/RendererTests/GitHubActionsRendererTests.swift
@@ -179,95 +179,39 @@ final class GitHubActionsRendererTests: XCTestCase {
 
     func testExecuted() throws {
         let input1 = "Test Suite 'All tests' failed at 2022-01-15 21:31:49.073."
-        let input2 = "Executed 3 tests, with 2 failures (1 unexpected) in 0.112 (0.112) seconds"
-
-        let input3 = "Test Suite 'All tests' passed at 2022-01-15 21:33:49.073."
-        let input4 = "Executed 1 test, with 1 failure (1 unexpected) in 0.200 (0.200) seconds"
-
-        // First test plan
-        XCTAssertNil(parser.summary)
-        XCTAssertFalse(parser.needToRecordSummary)
         let formatted1 = logFormatted(input1)
-        #if os(macOS)
-        // FIXME: Failing on Linux
-        XCTAssertTrue(parser.needToRecordSummary)
-        #endif
+        XCTAssertEqual(input1, formatted1)
+
+        let input2 = "Executed 3 tests, with 2 failures (1 unexpected) in 0.112 (0.112) seconds"
         let formatted2 = logFormatted(input2)
-        XCTAssertFalse(parser.needToRecordSummary)
-        XCTAssertNil(formatted1)
-        XCTAssertNil(formatted2)
+        XCTAssertEqual(input2, formatted2)
 
-        #if os(macOS)
-        // FIXME: Failing on Linux
-        var summary = try XCTUnwrap(parser.summary)
-
-        XCTAssertEqual(summary.testsCount, 3)
-        XCTAssertEqual(summary.failuresCount, 2)
-        XCTAssertEqual(summary.unexpectedCount, 1)
-        XCTAssertEqual(summary.skippedCount, 0)
-        XCTAssertEqual(summary.time, 0.112)
-
-        // Second test plan
-        XCTAssertNotNil(parser.summary)
-        XCTAssertFalse(parser.needToRecordSummary)
+        let input3 = "Test Suite 'All tests' passed at 2022-01-15 21:33:49.073."
         let formatted3 = logFormatted(input3)
-        XCTAssertTrue(parser.needToRecordSummary)
-        let formatted4 = logFormatted(input4)
-        XCTAssertFalse(parser.needToRecordSummary)
-        XCTAssertNil(formatted3)
-        XCTAssertNil(formatted4)
+        XCTAssertEqual(input3, formatted3)
 
-        summary = try XCTUnwrap(parser.summary)
-
-        XCTAssertEqual(summary.testsCount, 4)
-        XCTAssertEqual(summary.failuresCount, 3)
-        XCTAssertEqual(summary.unexpectedCount, 2)
-        XCTAssertEqual(summary.skippedCount, 0)
-        XCTAssertEqual(summary.time, 0.312)
-        #endif
+        let input4 = "Executed 1 test, with 1 failure (1 unexpected) in 0.200 (0.200) seconds"
+        let formatted4 = logFormatted(input4)
+        XCTAssertEqual(input4, formatted4)
     }
 
     #if os(macOS)
     func testExecutedWithSkipped() {
         let input1 = "Test Suite 'All tests' failed at 2022-01-15 21:31:49.073."
+        let formatted1 = logFormatted(input1)
+        XCTAssertEqual(input1, formatted1)
+
         let input2 = "Executed 56 tests, with 3 test skipped and 2 failures (1 unexpected) in 1.029 (1.029) seconds"
+        let formatted2 = logFormatted(input2)
+        XCTAssertEqual(input2, formatted2)
 
         let input3 = "Test Suite 'All tests' passed at 2022-01-15 21:33:49.073."
-        let input4 = "Executed 1 test, with 1 test skipped and 1 failure (1 unexpected) in 3.000 (3.000) seconds"
-
-        // First test plan
-        XCTAssertNil(parser.summary)
-        XCTAssertFalse(parser.needToRecordSummary)
-        let formatted1 = logFormatted(input1)
-        XCTAssertTrue(parser.needToRecordSummary)
-        let formatted2 = logFormatted(input2)
-        XCTAssertFalse(parser.needToRecordSummary)
-        XCTAssertNil(formatted1)
-        XCTAssertNil(formatted2)
-        XCTAssertNotNil(parser.summary)
-
-        XCTAssertEqual(parser.summary?.testsCount, 56)
-        XCTAssertEqual(parser.summary?.failuresCount, 2)
-        XCTAssertEqual(parser.summary?.unexpectedCount, 1)
-        XCTAssertEqual(parser.summary?.skippedCount, 3)
-        XCTAssertEqual(parser.summary?.time, 1.029)
-
-        // Second test plan
-        XCTAssertNotNil(parser.summary)
-        XCTAssertFalse(parser.needToRecordSummary)
         let formatted3 = logFormatted(input3)
-        XCTAssertTrue(parser.needToRecordSummary)
-        let formatted4 = logFormatted(input4)
-        XCTAssertFalse(parser.needToRecordSummary)
-        XCTAssertNil(formatted3)
-        XCTAssertNil(formatted4)
-        XCTAssertNotNil(parser.summary)
+        XCTAssertEqual(input3, formatted3)
 
-        XCTAssertEqual(parser.summary?.testsCount, 57)
-        XCTAssertEqual(parser.summary?.failuresCount, 3)
-        XCTAssertEqual(parser.summary?.unexpectedCount, 2)
-        XCTAssertEqual(parser.summary?.skippedCount, 4)
-        XCTAssertEqual(parser.summary?.time, 4.029)
+        let input4 = "Executed 1 test, with 1 test skipped and 1 failure (1 unexpected) in 3.000 (3.000) seconds"
+        let formatted4 = logFormatted(input4)
+        XCTAssertEqual(input4, formatted4)
     }
     #endif
 
@@ -534,23 +478,16 @@ final class GitHubActionsRendererTests: XCTestCase {
     #if os(macOS)
     func testTestSuiteAllTestsPassed() {
         let input = "Test Suite 'All tests' passed at 2022-01-15 21:31:49.073."
-
-        XCTAssertFalse(parser.needToRecordSummary)
         let formatted = logFormatted(input)
-        XCTAssertNil(formatted)
-        XCTAssertTrue(parser.needToRecordSummary)
-        XCTAssertEqual(parser.outputType, .undefined)
+        XCTAssertEqual(input, formatted)
     }
     #endif
 
     #if os(macOS)
     func testTestSuiteAllTestsFailed() {
         let input = "Test Suite 'All tests' failed at 2022-01-15 21:31:49.073."
-
-        XCTAssertFalse(parser.needToRecordSummary)
         let formatted = logFormatted(input)
-        XCTAssertNil(formatted)
-        XCTAssertTrue(parser.needToRecordSummary)
+        XCTAssertEqual(input, formatted)
     }
     #endif
 
diff --git a/Tests/XcbeautifyLibTests/RendererTests/TeamCityRendererTests.swift b/Tests/XcbeautifyLibTests/RendererTests/TeamCityRendererTests.swift
index 450a552..acc6e9c 100644
--- a/Tests/XcbeautifyLibTests/RendererTests/TeamCityRendererTests.swift
+++ b/Tests/XcbeautifyLibTests/RendererTests/TeamCityRendererTests.swift
@@ -162,95 +162,39 @@ final class TeamCityRendererTests: XCTestCase {
 
     func testExecutedWithoutSkipped() throws {
         let input1 = "Test Suite 'All tests' failed at 2022-01-15 21:31:49.073."
-        let input2 = "Executed 3 tests, with 2 failures (1 unexpected) in 0.112 (0.112) seconds"
-
-        let input3 = "Test Suite 'All tests' passed at 2022-01-15 21:33:49.073."
-        let input4 = "Executed 1 test, with 1 failure (1 unexpected) in 0.200 (0.200) seconds"
-
-        // First test plan
-        XCTAssertNil(parser.summary)
-        XCTAssertFalse(parser.needToRecordSummary)
         let formatted1 = noColoredFormatted(input1)
-        #if os(macOS)
-        // FIXME: Failing on Linux
-        XCTAssertTrue(parser.needToRecordSummary)
-        #endif
+        XCTAssertEqual(input1, formatted1)
+
+        let input2 = "Executed 3 tests, with 2 failures (1 unexpected) in 0.112 (0.112) seconds"
         let formatted2 = noColoredFormatted(input2)
-        XCTAssertFalse(parser.needToRecordSummary)
-        XCTAssertNil(formatted1)
-        XCTAssertNil(formatted2)
+        XCTAssertEqual(input2, formatted2)
 
-        #if os(macOS)
-        // FIXME: Failing on Linux
-        var summary = try XCTUnwrap(parser.summary)
-
-        XCTAssertEqual(summary.testsCount, 3)
-        XCTAssertEqual(summary.failuresCount, 2)
-        XCTAssertEqual(summary.unexpectedCount, 1)
-        XCTAssertEqual(summary.skippedCount, 0)
-        XCTAssertEqual(summary.time, 0.112)
-
-        // Second test plan
-        XCTAssertNotNil(parser.summary)
-        XCTAssertFalse(parser.needToRecordSummary)
+        let input3 = "Test Suite 'All tests' passed at 2022-01-15 21:33:49.073."
         let formatted3 = noColoredFormatted(input3)
-        XCTAssertTrue(parser.needToRecordSummary)
-        let formatted4 = noColoredFormatted(input4)
-        XCTAssertFalse(parser.needToRecordSummary)
-        XCTAssertNil(formatted3)
-        XCTAssertNil(formatted4)
-
-        summary = try XCTUnwrap(parser.summary)
+        XCTAssertEqual(input3, formatted3)
 
-        XCTAssertEqual(summary.testsCount, 4)
-        XCTAssertEqual(summary.failuresCount, 3)
-        XCTAssertEqual(summary.unexpectedCount, 2)
-        XCTAssertEqual(summary.skippedCount, 0)
-        XCTAssertEqual(summary.time, 0.312)
-        #endif
+        let input4 = "Executed 1 test, with 1 failure (1 unexpected) in 0.200 (0.200) seconds"
+        let formatted4 = noColoredFormatted(input4)
+        XCTAssertEqual(input4, formatted4)
     }
 
     #if os(macOS)
     func testExecutedWithSkipped() {
         let input1 = "Test Suite 'All tests' failed at 2022-01-15 21:31:49.073."
+        let formatted1 = noColoredFormatted(input1)
+        XCTAssertEqual(input1, formatted1)
+
         let input2 = "Executed 56 tests, with 3 test skipped and 2 failures (1 unexpected) in 1.029 (1.029) seconds"
+        let formatted2 = noColoredFormatted(input2)
+        XCTAssertEqual(input2, formatted2)
 
         let input3 = "Test Suite 'All tests' passed at 2022-01-15 21:33:49.073."
-        let input4 = "Executed 1 test, with 1 test skipped and 1 failure (1 unexpected) in 3.000 (3.000) seconds"
-
-        // First test plan
-        XCTAssertNil(parser.summary)
-        XCTAssertFalse(parser.needToRecordSummary)
-        let formatted1 = noColoredFormatted(input1)
-        XCTAssertTrue(parser.needToRecordSummary)
-        let formatted2 = noColoredFormatted(input2)
-        XCTAssertFalse(parser.needToRecordSummary)
-        XCTAssertNil(formatted1)
-        XCTAssertNil(formatted2)
-        XCTAssertNotNil(parser.summary)
-
-        XCTAssertEqual(parser.summary?.testsCount, 56)
-        XCTAssertEqual(parser.summary?.failuresCount, 2)
-        XCTAssertEqual(parser.summary?.unexpectedCount, 1)
-        XCTAssertEqual(parser.summary?.skippedCount, 3)
-        XCTAssertEqual(parser.summary?.time, 1.029)
-
-        // Second test plan
-        XCTAssertNotNil(parser.summary)
-        XCTAssertFalse(parser.needToRecordSummary)
         let formatted3 = noColoredFormatted(input3)
-        XCTAssertTrue(parser.needToRecordSummary)
-        let formatted4 = noColoredFormatted(input4)
-        XCTAssertFalse(parser.needToRecordSummary)
-        XCTAssertNil(formatted3)
-        XCTAssertNil(formatted4)
-        XCTAssertNotNil(parser.summary)
+        XCTAssertEqual(input3, formatted3)
 
-        XCTAssertEqual(parser.summary?.testsCount, 57)
-        XCTAssertEqual(parser.summary?.failuresCount, 3)
-        XCTAssertEqual(parser.summary?.unexpectedCount, 2)
-        XCTAssertEqual(parser.summary?.skippedCount, 4)
-        XCTAssertEqual(parser.summary?.time, 4.029)
+        let input4 = "Executed 1 test, with 1 test skipped and 1 failure (1 unexpected) in 3.000 (3.000) seconds"
+        let formatted4 = noColoredFormatted(input4)
+        XCTAssertEqual(input4, formatted4)
     }
     #endif
 
@@ -506,22 +450,16 @@ final class TeamCityRendererTests: XCTestCase {
     #if os(macOS)
     func testTestSuiteAllTestsPassed() {
         let input = "Test Suite 'All tests' passed at 2022-01-15 21:31:49.073."
-
-        XCTAssertFalse(parser.needToRecordSummary)
         let formatted = noColoredFormatted(input)
-        XCTAssertNil(formatted)
-        XCTAssertTrue(parser.needToRecordSummary)
+        XCTAssertEqual(input, formatted)
     }
     #endif
 
     #if os(macOS)
     func testTestSuiteAllTestsFailed() {
         let input = "Test Suite 'All tests' failed at 2022-01-15 21:31:49.073."
-
-        XCTAssertFalse(parser.needToRecordSummary)
         let formatted = noColoredFormatted(input)
-        XCTAssertNil(formatted)
-        XCTAssertTrue(parser.needToRecordSummary)
+        XCTAssertEqual(input, formatted)
     }
     #endif
 
diff --git a/Tests/XcbeautifyLibTests/RendererTests/TerminalRendererTests.swift b/Tests/XcbeautifyLibTests/RendererTests/TerminalRendererTests.swift
index dfaf9b2..57c16cd 100644
--- a/Tests/XcbeautifyLibTests/RendererTests/TerminalRendererTests.swift
+++ b/Tests/XcbeautifyLibTests/RendererTests/TerminalRendererTests.swift
@@ -159,95 +159,39 @@ final class TerminalRendererTests: XCTestCase {
 
     func testExecutedWithoutSkipped() throws {
         let input1 = "Test Suite 'All tests' failed at 2022-01-15 21:31:49.073."
-        let input2 = "Executed 3 tests, with 2 failures (1 unexpected) in 0.112 (0.112) seconds"
-
-        let input3 = "Test Suite 'All tests' passed at 2022-01-15 21:33:49.073."
-        let input4 = "Executed 1 test, with 1 failure (1 unexpected) in 0.200 (0.200) seconds"
-
-        // First test plan
-        XCTAssertNil(parser.summary)
-        XCTAssertFalse(parser.needToRecordSummary)
         let formatted1 = noColoredFormatted(input1)
-        #if os(macOS)
-        // FIXME: Failing on Linux
-        XCTAssertTrue(parser.needToRecordSummary)
-        #endif
+        XCTAssertEqual(input1, formatted1)
+
+        let input2 = "Executed 3 tests, with 2 failures (1 unexpected) in 0.112 (0.112) seconds"
         let formatted2 = noColoredFormatted(input2)
-        XCTAssertFalse(parser.needToRecordSummary)
-        XCTAssertNil(formatted1)
-        XCTAssertNil(formatted2)
+        XCTAssertEqual(input2, formatted2)
 
-        #if os(macOS)
-        // FIXME: Failing on Linux
-        var summary = try XCTUnwrap(parser.summary)
-
-        XCTAssertEqual(summary.testsCount, 3)
-        XCTAssertEqual(summary.failuresCount, 2)
-        XCTAssertEqual(summary.unexpectedCount, 1)
-        XCTAssertEqual(summary.skippedCount, 0)
-        XCTAssertEqual(summary.time, 0.112)
-
-        // Second test plan
-        XCTAssertNotNil(parser.summary)
-        XCTAssertFalse(parser.needToRecordSummary)
+        let input3 = "Test Suite 'All tests' passed at 2022-01-15 21:33:49.073."
         let formatted3 = noColoredFormatted(input3)
-        XCTAssertTrue(parser.needToRecordSummary)
-        let formatted4 = noColoredFormatted(input4)
-        XCTAssertFalse(parser.needToRecordSummary)
-        XCTAssertNil(formatted3)
-        XCTAssertNil(formatted4)
-
-        summary = try XCTUnwrap(parser.summary)
+        XCTAssertEqual(input3, formatted3)
 
-        XCTAssertEqual(summary.testsCount, 4)
-        XCTAssertEqual(summary.failuresCount, 3)
-        XCTAssertEqual(summary.unexpectedCount, 2)
-        XCTAssertEqual(summary.skippedCount, 0)
-        XCTAssertEqual(summary.time, 0.312)
-        #endif
+        let input4 = "Executed 1 test, with 1 failure (1 unexpected) in 0.200 (0.200) seconds"
+        let formatted4 = noColoredFormatted(input4)
+        XCTAssertEqual(input4, formatted4)
     }
 
     #if os(macOS)
     func testExecutedWithSkipped() {
         let input1 = "Test Suite 'All tests' failed at 2022-01-15 21:31:49.073."
+        let formatted1 = noColoredFormatted(input1)
+        XCTAssertEqual(input1, formatted1)
+
         let input2 = "Executed 56 tests, with 3 test skipped and 2 failures (1 unexpected) in 1.029 (1.029) seconds"
+        let formatted2 = noColoredFormatted(input2)
+        XCTAssertEqual(input2, formatted2)
 
         let input3 = "Test Suite 'All tests' passed at 2022-01-15 21:33:49.073."
-        let input4 = "Executed 1 test, with 1 test skipped and 1 failure (1 unexpected) in 3.000 (3.000) seconds"
-
-        // First test plan
-        XCTAssertNil(parser.summary)
-        XCTAssertFalse(parser.needToRecordSummary)
-        let formatted1 = noColoredFormatted(input1)
-        XCTAssertTrue(parser.needToRecordSummary)
-        let formatted2 = noColoredFormatted(input2)
-        XCTAssertFalse(parser.needToRecordSummary)
-        XCTAssertNil(formatted1)
-        XCTAssertNil(formatted2)
-        XCTAssertNotNil(parser.summary)
-
-        XCTAssertEqual(parser.summary?.testsCount, 56)
-        XCTAssertEqual(parser.summary?.failuresCount, 2)
-        XCTAssertEqual(parser.summary?.unexpectedCount, 1)
-        XCTAssertEqual(parser.summary?.skippedCount, 3)
-        XCTAssertEqual(parser.summary?.time, 1.029)
-
-        // Second test plan
-        XCTAssertNotNil(parser.summary)
-        XCTAssertFalse(parser.needToRecordSummary)
         let formatted3 = noColoredFormatted(input3)
-        XCTAssertTrue(parser.needToRecordSummary)
-        let formatted4 = noColoredFormatted(input4)
-        XCTAssertFalse(parser.needToRecordSummary)
-        XCTAssertNil(formatted3)
-        XCTAssertNil(formatted4)
-        XCTAssertNotNil(parser.summary)
+        XCTAssertEqual(input3, formatted3)
 
-        XCTAssertEqual(parser.summary?.testsCount, 57)
-        XCTAssertEqual(parser.summary?.failuresCount, 3)
-        XCTAssertEqual(parser.summary?.unexpectedCount, 2)
-        XCTAssertEqual(parser.summary?.skippedCount, 4)
-        XCTAssertEqual(parser.summary?.time, 4.029)
+        let input4 = "Executed 1 test, with 1 test skipped and 1 failure (1 unexpected) in 3.000 (3.000) seconds"
+        let formatted4 = noColoredFormatted(input4)
+        XCTAssertEqual(input4, formatted4)
     }
     #endif
 
@@ -515,22 +459,16 @@ final class TerminalRendererTests: XCTestCase {
     #if os(macOS)
     func testTestSuiteAllTestsPassed() {
         let input = "Test Suite 'All tests' passed at 2022-01-15 21:31:49.073."
-
-        XCTAssertFalse(parser.needToRecordSummary)
         let formatted = noColoredFormatted(input)
-        XCTAssertNil(formatted)
-        XCTAssertTrue(parser.needToRecordSummary)
+        XCTAssertEqual(input, formatted)
     }
     #endif
 
     #if os(macOS)
     func testTestSuiteAllTestsFailed() {
         let input = "Test Suite 'All tests' failed at 2022-01-15 21:31:49.073."
-
-        XCTAssertFalse(parser.needToRecordSummary)
         let formatted = noColoredFormatted(input)
-        XCTAssertNil(formatted)
-        XCTAssertTrue(parser.needToRecordSummary)
+        XCTAssertEqual(input, formatted)
     }
     #endif