Now that you have a manager class, learn how you need to make sure it is tested. This video continues your work on the applications test suite.
- [Instructor] Before we go any further,…let's add some comments, so that we can have a clean idea…of what we're doing in each test class.…So here I'm just going to add pragma MARK,…with two forward slashes,…and I'm going to say Initial Values for these tests,…and underneath our testInit_MoviesSeen,…I'm going to add another pragma MARK, and we're going to call this…the Add & Query section.…All right, so let's keep flushing out the MovieManager class…with the ability to add movies to our library,…which will also increase the moviesToSeeCount…each time we call this.…
So let's start with our new function,…func testAdd_MoviesToSee_ReturnsOne(),…and in here we want a test movie,…so let testMovie = Movie(title: "Sci-Fi"),…and we're going to use our sut.addMovie.…Now this function doesn't exist yet,…but it's going to take in a movie when it does,…and we're just going to pass it in our testMovie.…
Finally, let's add our XCTAssertEqual,…and we want to make sure that our sut.moviesToSeeCount…is 1, after we add a new movie to our empty library.…
- What is test-driven development?
- Creating and expanding a data model
- Creating a manager class
- Testing class methods
- Checking for duplicates
- Testing table views
- Mocking cells
- Testing cell selection
- Assembling the app
Skill Level Intermediate
1. Foundation and Theory
2. Getting Started
3. The Manager Class
4. TableView Testing
5. Finishing Touches
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.