November 2018
Intermediate to advanced
404 pages
10h 16m
English
Swift test assertions are useful in checking expected results in test methods. There is a family of macros similar to XCTAssert() to help evaluate any given conditions. Each macro optionally allows a literal NSString to describe what happens when there is a failure. For XCTAssert(), a failure is when the Boolean expression == false:
| Macro | Usage |
|---|---|
| XCTAssertTrue() | Assert an expression to be true |
| XCTAssertFalse() | Assert an expression to be false |
| XCTAssertNil() | Assert an expression to be nil |
| XCTAssertNotNil() | Assert an expression to be not nil |
| XCTAssertEqual() | Assert two expressions to have the same value |
| XCTAssertNotEqual() | Assert two expressions to have the different value |
| XCTAssertEqualObjects() ... |
Read now
Unlock full access