Allow skipping tests in test targets (#582)

Allow skipping tests in test targets
This commit is contained in:
Yonas Kolb
2019-05-22 23:06:05 +10:00
committed by GitHub
5 changed files with 19 additions and 4 deletions
+1
View File
@@ -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
+7 -1
View File
@@ -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
+6 -1
View File
@@ -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") ?? []
}
}
+2 -1
View File
@@ -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)
)
}
@@ -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()"]
),
]
)