Write UI component tests with mocks.
- [Teacher] We now have tests to ensure…that TableView delegated data source…are properly set to our data service object.…So now we can get to the fun stuff.…To create a new test file for the data service…here in our FilmFest Tests folder…and in TestControllers.…Create a new file.…iOS Unit Test Case Class.…I'm going to call mine MovieLibraryDataServiceTests.…Next and create.…Let's add our @testable import line…and delete our boilerplate code.…
We're going to keep the room.…Here on line 24, we're going to write our first test,…and it's going to test whether our section count…for our TableView is correct and it should return two.…So func testTableViewSectionCount…underscore ShouldBeTwo.…And we need to do a few things here.…We need an instance of our data service,…and we need a UI TableView instance to test this.…Let dataService equal MovieLibraryDataService.…
Let tableView equal UITableView.…We're going to set our tableView.dataSource…to our dataService.…And we need to retrieve the number of sections…from that TableView.…
- Test-driven development: history and theory
- Creating a data model test
- Expanding tests
- Testing class methods
- Checking for duplicates
- Testing table views
- Mocking cells
- Testing cell selection
- Assembling the app
Skill Level Intermediate
Distributing Your iOS App for Testing with TestFlightwith Ron Buencamino35m 10s Intermediate
1. Foundation and Theory
2. Data Models and the Manager Class
3. UITableView Testing
4. Finishing Touches and Xcode Features
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.