Start from Test Zero
Now we have a home for our next set of tests. Before we get into our experiments around life cycles, I’d like to show you a trick. First, whenever I create a new test suite, I start with a special test I call Test Zero. Add the following test to MyClassTests:
| func test_zero() { |
| XCTFail("Tests not yet implemented in MyClassTests") |
| } |
I call it Test Zero because it precedes the first real test we want to write. Go ahead and run tests to make sure it fails. Why? This is a check of our infrastructure. It confirms that our basic test plumbing is correct.
Test Zero helps separate our problems so we can tackle them one at a time. When we create a new test suite, we’re usually ...
Get iOS Unit Testing by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.