Skip to content

Instantly share code, notes, and snippets.

@msewell
Last active February 17, 2021 14:42
Show Gist options
  • Save msewell/4b78574effe23f222c534e91d868cde7 to your computer and use it in GitHub Desktop.
Save msewell/4b78574effe23f222c534e91d868cde7 to your computer and use it in GitHub Desktop.
Invoke an XCTest multiple times by overriding XCTestCase's `invokeTest()` function
// 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