Skip to content

Commit

Permalink
Add support for xcresult v3.34 (#65)
Browse files Browse the repository at this point in the history
Change Description: Adds support for new properties and objects described in xcresulttool's v3.34 of the formatDescription.

Test Plan/Testing Performed: Need to add unit tests for the new objects. Was able to confirm that new UUID properties were parsing out properly with existing xcresult.
  • Loading branch information
abotkin-cpi authored Aug 17, 2021
1 parent 7b7972e commit 4553702
Show file tree
Hide file tree
Showing 10 changed files with 579 additions and 2 deletions.
420 changes: 420 additions & 0 deletions FormatDescriptions/xcresult-3.34.txt

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Sources/XCParseCore/ActionTestActivitySummary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ open class ActionTestActivitySummary : Codable {
// xcresult 3.26 and above
public let failureSummaryIDs: [String]

// xcresult 3.34 and above
public let expectedFailureIDs: [String]

enum ActionTestActivitySummaryCodingKeys: String, CodingKey {
case title
case activityType
Expand All @@ -37,6 +40,7 @@ open class ActionTestActivitySummary : Codable {
case attachments
case subactivities
case failureSummaryIDs
case expectedFailureIDs
}

required public init(from decoder: Decoder) throws {
Expand All @@ -50,5 +54,6 @@ open class ActionTestActivitySummary : Codable {
attachments = try container.decodeXCResultArray(forKey: .attachments)
subactivities = try container.decodeXCResultArray(forKey: .subactivities)
failureSummaryIDs = try container.decodeXCResultArray(forKey: .failureSummaryIDs)
expectedFailureIDs = try container.decodeXCResultArray(forKey: .expectedFailureIDs)
}
}
5 changes: 5 additions & 0 deletions Sources/XCParseCore/ActionTestAttachment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ open class ActionTestAttachment : Codable {
public let payloadRef: Reference?
public let payloadSize: Int

// xcresult 3.34 and above
public let uuid: String?

enum ActionTestAttachmentCodingKeys: String, CodingKey {
case uniformTypeIdentifier
case name
case uuid
case timestamp
case userInfo
case lifetime
Expand All @@ -40,6 +44,7 @@ open class ActionTestAttachment : Codable {
let container = try decoder.container(keyedBy: ActionTestAttachmentCodingKeys.self)
uniformTypeIdentifier = try container.decodeXCResultType(forKey: .uniformTypeIdentifier)
name = try container.decodeXCResultTypeIfPresent(forKey: .name)
uuid = try container.decodeXCResultTypeIfPresent(forKey: .uuid)
timestamp = try container.decodeXCResultTypeIfPresent(forKey: .timestamp)
userInfo = try container.decodeXCResultObjectIfPresent(forKey: .userInfo)
lifetime = try container.decodeXCResultType(forKey: .lifetime)
Expand Down
23 changes: 23 additions & 0 deletions Sources/XCParseCore/ActionTestConfiguration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// ActionTestConfiguration.swift
// XCParseCore
//
// Created by Alex Botkin on 8/16/21.
// Copyright © 2021 ChargePoint, Inc. All rights reserved.
//

import Foundation

// xcresult 3.34 and above
open class ActionTestConfiguration : Codable {
public let values: SortedKeyValueArray

enum ActionTestConfigurationCodingKeys: String, CodingKey {
case values
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: ActionTestConfigurationCodingKeys.self)
values = try container.decodeXCResultObject(forKey: .values)
}
}
33 changes: 33 additions & 0 deletions Sources/XCParseCore/ActionTestExpectedFailure.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// ActionTestExpectedFailure.swift
// XCParseCore
//
// Created by Alex Botkin on 8/16/21.
// Copyright © 2021 ChargePoint, Inc. All rights reserved.
//

import Foundation

// xcresult 3.34 and above
open class ActionTestExpectedFailure : Codable {
public let uuid: String
public let failureReason: String?
public let failureSummary: ActionTestFailureSummary?
public let isTopLevelFailure: Bool

enum ActionTestExpectedFailureCodingKeys: String, CodingKey {
case uuid
case failureReason
case failureSummary
case isTopLevelFailure
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: ActionTestExpectedFailureCodingKeys.self)

uuid = try container.decodeXCResultType(forKey: .uuid)
failureReason = try container.decodeXCResultTypeIfPresent(forKey: .failureReason)
failureSummary = try container.decodeXCResultObjectIfPresent(forKey: .failureSummary)
isTopLevelFailure = try container.decodeXCResultType(forKey: .isTopLevelFailure)
}
}
29 changes: 29 additions & 0 deletions Sources/XCParseCore/ActionTestNoticeSummary.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// ActionTestNoticeSummary.swift
// XCParseCore
//
// Created by Alex Botkin on 8/16/21.
// Copyright © 2021 ChargePoint, Inc. All rights reserved.
//

import Foundation

open class ActionTestNoticeSummary : Codable {
public let message: String?
public let fileName: String
public let lineNumber: Int

enum ActionTestNoticeSummaryCodingKeys: String, CodingKey {
case message
case fileName
case lineNumber
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: ActionTestNoticeSummaryCodingKeys.self)

message = try container.decodeXCResultTypeIfPresent(forKey: .message)
fileName = try container.decodeXCResultType(forKey: .fileName)
lineNumber = try container.decodeXCResultType(forKey: .lineNumber)
}
}
5 changes: 5 additions & 0 deletions Sources/XCParseCore/ActionTestPerformanceMetricSummary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ open class ActionTestPerformanceMetricSummary : Codable {
public let maxRegression: Double?
public let maxStandardDeviation: Double?

// xcresult 3.34 and above
public let polarity: String?

// Derived
public var metricType : ActionTestPerformanceMetric {
let identifierString = identifier ?? "Identifier Missing"
Expand All @@ -71,6 +74,7 @@ open class ActionTestPerformanceMetricSummary : Codable {
case maxPercentRelativeStandardDeviation
case maxRegression
case maxStandardDeviation
case polarity
}

required public init(from decoder: Decoder) throws {
Expand All @@ -87,5 +91,6 @@ open class ActionTestPerformanceMetricSummary : Codable {
maxPercentRelativeStandardDeviation = try container.decodeXCResultTypeIfPresent(forKey: .maxPercentRelativeStandardDeviation)
maxRegression = try container.decodeXCResultTypeIfPresent(forKey: .maxRegression)
maxStandardDeviation = try container.decodeXCResultTypeIfPresent(forKey: .maxStandardDeviation)
polarity = try container.decodeXCResultTypeIfPresent(forKey: .polarity)
}
}
30 changes: 30 additions & 0 deletions Sources/XCParseCore/ActionTestRepetitionPolicySummary.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// ActionTestRepetitionPolicySummary.swift
// XCParseCore
//
// Created by Alex Botkin on 8/16/21.
// Copyright © 2021 ChargePoint, Inc. All rights reserved.
//

import Foundation

// xcresult 3.34 and above
open class ActionTestRepetitionPolicySummary : Codable {
public let iteration: Int?
public let totalIterations: Int?
public let repetitionMode: String?

enum ActionTestRepetitionPolicySummaryCodingKeys: String, CodingKey {
case iteration
case totalIterations
case repetitionMode
}

required public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: ActionTestRepetitionPolicySummaryCodingKeys.self)

iteration = try container.decodeXCResultTypeIfPresent(forKey: .iteration)
totalIterations = try container.decodeXCResultTypeIfPresent(forKey: .totalIterations)
repetitionMode = try container.decodeXCResultTypeIfPresent(forKey: .repetitionMode)
}
}
17 changes: 16 additions & 1 deletion Sources/XCParseCore/ActionTestSummary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// XCParseCore
//
// Created by Alex Botkin on 10/4/19.
// Copyright © 2019 ChargePoint, Inc. All rights reserved.
// Copyright © 2021 ChargePoint, Inc. All rights reserved.
//

import Foundation
Expand All @@ -18,14 +18,24 @@ open class ActionTestSummary : ActionTestSummaryIdentifiableObject {
public let duration: Double
public let performanceMetrics: [ActionTestPerformanceMetricSummary]
public let failureSummaries: [ActionTestFailureSummary]
public let skipNoticeSummary: ActionTestNoticeSummary?
public let activitySummaries: [ActionTestActivitySummary]

// xcresult 3.34 and above
public let expectedFailures: [ActionTestExpectedFailure]
public let repetitionPolicySummary: ActionTestRepetitionPolicySummary?
public let configuration: ActionTestConfiguration?

enum ActionTestSummaryCodingKeys: String, CodingKey {
case testStatus
case duration
case performanceMetrics
case failureSummaries
case skipNoticeSummary
case activitySummaries
case expectedFailures
case repetitionPolicySummary
case configuration
}

required public init(from decoder: Decoder) throws {
Expand All @@ -35,8 +45,13 @@ open class ActionTestSummary : ActionTestSummaryIdentifiableObject {

performanceMetrics = try container.decodeXCResultArray(forKey: .performanceMetrics)
failureSummaries = try container.decodeXCResultArray(forKey: .failureSummaries)
skipNoticeSummary = try container.decodeXCResultObjectIfPresent(forKey: .skipNoticeSummary)
activitySummaries = try container.decodeXCResultArray(forKey: .activitySummaries)

expectedFailures = try container.decodeXCResultArray(forKey: .expectedFailures)
repetitionPolicySummary = try container.decodeXCResultObjectIfPresent(forKey: .repetitionPolicySummary)
configuration = try container.decodeXCResultObjectIfPresent(forKey: .configuration)

try super.init(from: decoder)
}

Expand Down
14 changes: 13 additions & 1 deletion Sources/XCParseCore/XCPResultDecoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// xcparse
//
// Created by Alex Botkin on 8/13/19.
// Copyright © 2019 ChargePoint, Inc. All rights reserved.
// Copyright © 2021 ChargePoint, Inc. All rights reserved.
//

import Foundation
Expand Down Expand Up @@ -118,11 +118,15 @@ enum XCResultTypeFamily: String, ClassFamily {
case ActionSDKRecord
case ActionTestActivitySummary
case ActionTestAttachment
case ActionTestConfiguration
case ActionTestExpectedFailure
case ActionTestFailureSummary
case ActionTestMetadata
case ActionTestNoticeSummary
case ActionTestPerformanceMetricSummary
case ActionTestPlanRunSummaries
case ActionTestPlanRunSummary
case ActionTestRepetitionPolicySummary
case ActionTestSummary
case ActionTestSummaryGroup
case ActionTestSummaryIdentifiableObject
Expand Down Expand Up @@ -189,16 +193,24 @@ enum XCResultTypeFamily: String, ClassFamily {
return XCParseCore.ActionTestActivitySummary.self
case .ActionTestAttachment:
return XCParseCore.ActionTestAttachment.self
case .ActionTestConfiguration:
return XCParseCore.ActionTestConfiguration.self
case .ActionTestExpectedFailure:
return XCParseCore.ActionTestExpectedFailure.self
case .ActionTestFailureSummary:
return XCParseCore.ActionTestFailureSummary.self
case .ActionTestMetadata:
return XCParseCore.ActionTestMetadata.self
case .ActionTestNoticeSummary:
return XCParseCore.ActionTestNoticeSummary.self
case .ActionTestPerformanceMetricSummary:
return XCParseCore.ActionTestPerformanceMetricSummary.self
case .ActionTestPlanRunSummaries:
return XCParseCore.ActionTestPlanRunSummaries.self
case .ActionTestPlanRunSummary:
return XCParseCore.ActionTestPlanRunSummary.self
case .ActionTestRepetitionPolicySummary:
return XCParseCore.ActionTestRepetitionPolicySummary.self
case .ActionTestSummary:
return XCParseCore.ActionTestSummary.self
case .ActionTestSummaryGroup:
Expand Down

0 comments on commit 4553702

Please sign in to comment.