From the course: iOS App Development: Test-Driven Development
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Mocking the TableView cell
From the course: iOS App Development: Test-Driven Development
Mocking the TableView cell
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Interface testing setup5m 33s
-
(Locked)
Data source and delegate setup8m 1s
-
(Locked)
TableView section one tests8m 41s
-
(Locked)
TableView section two tests4m 10s
-
(Locked)
Mocking the TableView cell10m 22s
-
(Locked)
Configure the TableView cell12m 35s
-
(Locked)
Test cell selection11m 35s
-
(Locked)
-
-