-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from tylervick/main
✨ Add repetitionPolicySummary support introduced with Xcode 13's test retry features
- Loading branch information
Showing
3 changed files
with
297 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
Sources/XCResultKit/ActionTestRepetitionPolicySummary.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// ActionTestRepetitionPolicySummary.swift | ||
// | ||
// | ||
// Created by Tyler Vick on 12/21/21. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct ActionTestRepetitionPolicySummary: XCResultObject { | ||
|
||
public let iteration: Int | ||
public let totalIterations: Int | ||
public let repetitionMode: RepetitionMode? | ||
|
||
public init?(_ json: [String: AnyObject]) { | ||
do { | ||
iteration = try xcRequired(element: "iteration", from: json) | ||
totalIterations = try xcRequired(element: "totalIterations", from: json) | ||
repetitionMode = RepetitionMode.from(xcOptional(element: "repetitionMode", from: json)) | ||
} catch { | ||
logError("Error parsing \(String(describing: ActionTestRepetitionPolicySummary.self)): \(error.localizedDescription)") | ||
return nil | ||
} | ||
} | ||
|
||
} | ||
|
||
public enum RepetitionMode: String { | ||
case none = "None" | ||
case runUntilFailure = "RunUntilFailure" | ||
case runRetryOnFailure = "RunRetryOnFailure" | ||
case upUntilMaximumRepetitions = "FixedIterations" | ||
|
||
static func from(_ str: String?) -> Self? { | ||
if let str = str { | ||
return self.init(rawValue: str) | ||
} | ||
return nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters