Mark DiFranco explains the reason we need to use mock classes. Learn which classes need to be mocked. Then, review some benefits of using mock classes when testing.
- [Instructor] Before we start writing tests…we'll first need to create mock versions…of some of our classes.…This will allow us to control the SUT in tests…and easily verify its behavior.…Mock classes are dummy classes…that don't actually do any work.…Instead they allow us to introspect which methods…were called and what its properties were set to.…A mock class is indispensable when testing classes…that have external side effects.…For example, when testing some code that makes…a web request we can use a mock class to verify…the correct methods recalled and ensure…that we don't make a real web request.…
- Why write unit tests?
- What is dependency injection?
- Using protocols to help with tests
- Handling external dependencies
- Anatomy of a test case
- Writing tests
- Analyzing code coverage
- Visualizing test results
- Writing and extending UI tests
Skill Level Intermediate
Core Data for iOS and macOS Enterprise Developerswith Jon Bott1h 46m Intermediate
Learning Server-Side Swift with Vaporwith Ron Buencamino1h 30m Intermediate
Swift 3 Essential Training: Beyond the Basicswith Scott Gardner2h 58m Intermediate
1. Dependency Injection
2. Using Protocols
3. Writing Tests
4. UI Tests
- 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.