Skip to content

Commit

Permalink
Make async tests less likely to fail on slower machines.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgauthier committed Jul 19, 2017
1 parent 2eb5438 commit d596f9b
Showing 1 changed file with 7 additions and 7 deletions.
Expand Up @@ -83,17 +83,17 @@ class AsyncTestingTests: MTKBaseTestCase {
}

if let queue = queue {
MTKWaitThenContinueTest(after: 10, on: queue, testAction: testAction)
MTKWaitThenContinueTest(after: 3, on: queue, testAction: testAction)
}
else {
MTKWaitThenContinueTest(after: 10, testAction: testAction)
MTKWaitThenContinueTest(after: 3, testAction: testAction)
}

waitDurationTester.assertActualDurationMatches(expectedDuration: 10, line: line)
waitDurationTester.assertActualDurationMatches(expectedDuration: 3, line: line)
}

performTest()
performTest(usingSpecificQueue: .global())
performTest(usingSpecificQueue: .global(qos: .userInteractive))
}

func testAsyncTestFailsWhenAssertionFailsInTheTestActionClosure() {
Expand All @@ -107,16 +107,16 @@ class AsyncTestingTests: MTKBaseTestCase {
let waitDurationTester = WaitDurationTester()
waitDurationTester.beginRecordingDuration()

MTKWaitThenContinueTest(after: 10) {
MTKWaitThenContinueTest(after: 3) {
waitDurationTester.endRecordingDuration(line: line)
self.recordFailure(withDescription: "Description", inFile: "File", atLine: 1, expected: true)
}

waitDurationTester.assertActualDurationMatches(expectedDuration: 10, line: line)
waitDurationTester.assertActualDurationMatches(expectedDuration: 3, line: line)
}
}

performTest()
performTest(usingSpecificQueue: .global())
performTest(usingSpecificQueue: .global(qos: .userInteractive))
}
}

0 comments on commit d596f9b

Please sign in to comment.