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.

TableView section one tests

TableView section one tests

From the course: iOS App Development: Test-Driven Development

Start my 1-month free trial

TableView section one tests

- [Instructor] OK, with the foundation of our data service all set up, we can move on to actually testing and implementing our table view functionality. In our Test Folder, I'm going to make a new group, going to call this Test Data Service, and inside this new folder, I'm going to create a new file, Unit Test Case Class, and I'm going to name it MovieLibraryDataServiceTests. Now let's add our @testable import at the top of the file, and let's delete the default functions from the body. Now the most basic test we can write at this point is to check that our table view always has two sections, one for movies to see, and one for movies we've already seen. I'm going to add a problem mark, just going to call this one Sections, and start a new test. Func testTableViewSections_Count_ReturnsTwo. Inside the test, we need two things, an instance of our new data service and a table view. Let's start let dataService equals a new instance of our MovieLibraryDataService, and let tableView equals…

Contents