diff --git a/CHANGELOG.md b/CHANGELOG.md index 30115b27..c43c8b13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ #### Added - Added ability to encode ProjectSpec to JSON [#545](https://github.com/yonaskolb/XcodeGen/pull/545) @ryohey +- Added ability to skip tests [#582](https://github.com/yonaskolb/XcodeGen/pull/582) @kadarandras ## 2.5.0 diff --git a/Docs/ProjectSpec.md b/Docs/ProjectSpec.md index ff8ba02f..de79d1c4 100644 --- a/Docs/ProjectSpec.md +++ b/Docs/ProjectSpec.md @@ -691,6 +691,7 @@ A multiline script can be written using the various YAML multiline methods, for - [x] **name**: **String** - The name of the target - [ ] **parallelizable**: **Bool** - Whether to run tests in parallel. Defaults to false - [ ] **randomExecutionOrder**: **Bool** - Whether to run tests in a random order. Defaults to false +- [ ] **skippedTests**: **[String]** - List of tests in the test target to skip. Defaults to empty. ### Archive Action @@ -719,7 +720,12 @@ schemes: config: prod-debug commandLineArguments: "--option testValue" gatherCoverageData: true - targets: [Tester1, Tester2] + targets: + - Tester1 + - name: Tester2 + parallelizable: true + randomExecutionOrder: true + skippedTests: [Test/testExample()] environmentVariables: - variable: TEST_ENV_VAR value: VALUE diff --git a/Sources/ProjectSpec/Scheme.swift b/Sources/ProjectSpec/Scheme.swift index 58e6c56c..29ee1241 100644 --- a/Sources/ProjectSpec/Scheme.swift +++ b/Sources/ProjectSpec/Scheme.swift @@ -106,21 +106,25 @@ public struct Scheme: Equatable { public let name: String public var randomExecutionOrder: Bool public var parallelizable: Bool + public var skippedTests: [String] public init( name: String, randomExecutionOrder: Bool = randomExecutionOrderDefault, - parallelizable: Bool = parallelizableDefault + parallelizable: Bool = parallelizableDefault, + skippedTests: [String] = [] ) { self.name = name self.randomExecutionOrder = randomExecutionOrder self.parallelizable = parallelizable + self.skippedTests = skippedTests } public init(stringLiteral value: String) { name = value randomExecutionOrder = false parallelizable = false + skippedTests = [] } } @@ -306,6 +310,7 @@ extension Scheme.Test.TestTarget: JSONObjectConvertible { name = try jsonDictionary.json(atKeyPath: "name") randomExecutionOrder = jsonDictionary.json(atKeyPath: "randomExecutionOrder") ?? Scheme.Test.TestTarget.randomExecutionOrderDefault parallelizable = jsonDictionary.json(atKeyPath: "parallelizable") ?? Scheme.Test.TestTarget.parallelizableDefault + skippedTests = jsonDictionary.json(atKeyPath: "skippedTests") ?? [] } } diff --git a/Sources/XcodeGenKit/SchemeGenerator.swift b/Sources/XcodeGenKit/SchemeGenerator.swift index fb1b021d..5b6c3d14 100644 --- a/Sources/XcodeGenKit/SchemeGenerator.swift +++ b/Sources/XcodeGenKit/SchemeGenerator.swift @@ -133,7 +133,8 @@ public class SchemeGenerator { skipped: false, parallelizable: testTarget.parallelizable, randomExecutionOrdering: testTarget.randomExecutionOrder, - buildableReference: testBuilEntries.buildableReference + buildableReference: testBuilEntries.buildableReference, + skippedTests: testTarget.skippedTests.map(XCScheme.SkippedTest.init) ) } diff --git a/Tests/XcodeGenKitTests/SpecLoadingTests.swift b/Tests/XcodeGenKitTests/SpecLoadingTests.swift index 82fc6c47..10357158 100644 --- a/Tests/XcodeGenKitTests/SpecLoadingTests.swift +++ b/Tests/XcodeGenKitTests/SpecLoadingTests.swift @@ -729,6 +729,7 @@ class SpecLoadingTests: XCTestCase { "name": "Target2", "parallelizable": true, "randomExecutionOrder": true, + "skippedTests": ["Test/testExample()"] ], ], "gatherCoverageData": true, @@ -760,7 +761,8 @@ class SpecLoadingTests: XCTestCase { Scheme.Test.TestTarget( name: "Target2", randomExecutionOrder: true, - parallelizable: true + parallelizable: true, + skippedTests: ["Test/testExample()"] ), ] )