Mark DiFranco introduces XCTest, the Xcode testing framework. He covers test cases, as well as the best way to organize your tests. Learn several useful patterns that help keep your tests organized and readable. Then, review helpful methods on the XCTestCase class.
- [Instructor] Earlier in the course…we covered the importance of tests.…Tests allow us to quickly verify the behavior…of our code, which helps us prevent bugs.…The first type of test we'll cover is the unit test.…Unit tests are small, quick tests…that run on a particular set of code.…Xcode provides the XCTest framework for unit testing,…so we'll use that for our tests.…In XCTest, unit tests are collected into test cases.…These test cases are represented by the XCTestCase class.…Each class in our app will have one corresponding test case…that tests its functionality,…thus each test case should have a reference…to the class it's testing.…
This reference is called the SUT,…which stands for subject under test.…The test case will also have zero or more DOCs,…which stands for depended-on component.…In our test, these will be represented by our mock classes.…Our tests will be using DOCs as well as the public interface…of the SUT to test the behavior of the SUT.…Let's move on to the tests themselves.…We'll follow a simple pattern for naming our tests…
- 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.