Creating Tests
Now that we know how to write tests—create a method with “test” in its name, and use XCTAssert-type methods to say what should be true during the test—let’s put our existing functionality to the test.
We can start with the outlets that we created in the last chapter. Since the app launches and immediately loads our URL, we should see the last part of the URL as the titleLabel text, and the button should say “Play” or “Pause” based on the current player state.
Our tests will need to access the outlets we’re testing, and this presents a little bit of a hassle that we haven’t had to consider before. Swift considers all the classes in the PragmaticPodcasts target to be one module, and classes in a module can see each other’s properties ...
Get iOS 10 SDK Development, 1st Edition 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.