TableView cells act as our primary mode of presentation in our application. In this video, learn how to mock a cell, and write tests to make sure that it dequeues from the TableView properly.
We're going to move on to testing our TableView cell right now,…which is normally a no-brainer, right?…We create a cell, we hook it up,…and we configure it with our data.…But because we're starting…to test out the TableView functionality,…we're going to introduce the concept of mocks.…Now, in essence, mocks are exactly what they sound like:…a mock-up or stand-in for the real thing in our app.…We're going to be using mocks pretty heavily from now on,…so it's a good time to get really familiar with the topic.…So while we're still in our library data service tests,…let's add a new pragma mark,…and we're going to call this Cells, and let's start off…with a new func testCell_RowAtIndex_ReturnsMovieCell.…
Now, inside this test,…we're just going to call sut.movieManager.addMovie.…We're going to add in darkComedy,…and we're going to reload our table view,…so libraryTableView.reload, and finally,…we need to pull out the new dequeued cellForRow,…so let cellQueried = libraryTableView.cellForRow,…and it's looking for an index path,…
- 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.