Last active
February 17, 2021 14:42
-
-
Save msewell/4b78574effe23f222c534e91d868cde7 to your computer and use it in GitHub Desktop.
Invoke an XCTest multiple times by overriding XCTestCase's `invokeTest()` function
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
// In any XCTestCase subclass: | |
override func invokeTest() { | |
let maxInvocations = 100 | |
(1...maxInvocations).forEach { | |
print("Test invocation: #\($0)/\(maxInvocations)") | |
super.invokeTest() | |
} | |
} | |
// In Objective-C: | |
- (void)invokeTest | |
{ | |
for (int i=0; i<100; i++) { | |
[super invokeTest]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment