Write the First Tests of the Change Password View Controller

Let’s begin writing tests for ChangePasswordViewController. If RefactoringTests.swift is still lingering around from creating the project, delete the file. Add a new test suite named ChangePasswordViewControllerTests. Do the normal Test Zero steps to confirm that it’s in the right place.

Then let’s start easy by testing the outlets. Since we know we’re going to be writing many tests, let’s put the system under test into the test fixture from the start. Here’s the content of the file so far:

 @testable​ ​import​ ​Refactoring
 import​ ​XCTest
 final​ ​class​ ​ChangePasswordViewControllerTests​: ​XCTestCase ...

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.