In this video, Mark DiFranco covers ways to help keep your UI tests predictable. Learn which classes should be mocked out to ensure as much of your code as possible is tested. Then, discover how to use launch arguments during UI tests to help with the mocking process.
- [Narrator] There are some issues to doing a test…of the full system.…We want to reduce the app's dependency on external systems.…If our app makes a web request,…we don't want the test to fail when the server is down…or if the request takes too long.…We want our UITest to be as predictable as possible.…Luckily, because of how we've architected our app,…we can easily mock out the unpredictable parts of our app.…Since we want to test as much of our system as we can,…it's best to mock out classes as low a level as possible.…This allows the test to use as much of our code as possible.…
For instance if we were trying to mock up…the app's web requests,…we would create a mock of URLSession…and not one of a higher level class.…XCUITest provides an API for passing information…to our app during UITests.…So let's take a look at how we can use that…to mock out classes in our project.…In order to mock out certain classes during UITests,…we're going to use something called launchArguments.…LaunchArguments will be passed…to our app when it is launched.…
- 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
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?
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.