Why don't we write enough tests? Is it because testing is hard or we are lazy? Maybe there is no budget for it? There has to be a better way than not noticing an elephant in the room and not writing them at all.In this presentation you will see how to avoid common traps and follow best practices to take a step forward towards mastering unit tests in practice.
24. XCTestExpectation API
• Define minimum fulfill() calls
•var expectedFulfillmentCount: Int
• Allow more fulfill() calls
•var assertForOverFulfill: Bool
• Do not expect filfill()
• var isInverted: Bool
25. Negative expectation
func testCancelling(){
// Arrange
let actionToken = something.begin {result in
//completion
}
// Act
actionToken.cancel()
// Assert
// Verify completion not called
}
??