When our TableView is initialized, we need to test its initial state and property values. In this video, learn how to write tests that cover the TableView's first section.
- [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 an instance of UITableView.…
- 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.