WBF AcademyWBF Academy
Test-Driven Development in Swift
Intermediate Programming Languages

Test-Driven Development in Swift

Write Swift you can change without fear. This intermediate course teaches test-driven development the way it actually works on a real codebase: you write a failing test first, make it pass with the simplest thing possible, then refactor while the suite stays green. It is built on Swift Testing, the modern framework with @Test, #expect, #require, suites, traits, and parameterized tests, and it also covers XCTest where you still need it, for UI and performance tests and for migrating an existing suite. You will go well past the basics: designing types that are testable in the first place through dependency injection and protocol seams, building stubs, spies and fakes without a mocking framework, testing async/await, actors and MainActor code deterministically instead of with sleeps, and taming legacy code with characterization tests. You will also learn what TDD does not solve, why chasing 100% coverage makes suites worse, and how to keep tests fast and free of flakiness. Assumes you already write Swift comfortably. By the end, tests will be how you design code, not a chore you do afterwards.

5 modules 15 lessons 6 h 350 questions

Course content

1 TDD Foundations: Red, Green, Refactor 3 lessons · 1 practice 0 of 4
Lesson 1 · 6:10The Red, Green, Refactor Loop
6:10
The Red, Green, Refactor Loop
Video · 6:10
Watch lesson ▶
Lesson 2 · 5:35Tests That Earn Their Keep
5:35
Tests That Earn Their Keep
Video · 5:35
Watch lesson ▶
Lesson 3 · 6:25The Discipline and Its Limits
6:25
The Discipline and Its Limits
Video · 6:25
Watch lesson ▶
Practice · 0 of 35 questionsModule practice
Module practice 0 of 35 for the certificate
Answer 35 questions
This module has 70 questions; 35 count toward the certificate.
Practice →
2 Swift Testing in Practice 3 lessons · 1 practice 0 of 4
Lesson 1 · 6:07Swift Testing Essentials
6:07
Swift Testing Essentials
Video · 6:07
Watch lesson ▶
Lesson 2 · 6:48Suites, Traits & Parameterized Tests
6:48
Suites, Traits & Parameterized Tests
Video · 6:48
Watch lesson ▶
Lesson 3 · 7:23Migrating from XCTest
7:23
Migrating from XCTest
Video · 7:23
Watch lesson ▶
Practice · 0 of 35 questionsModule practice
Module practice 0 of 35 for the certificate
Answer 35 questions
This module has 70 questions; 35 count toward the certificate.
Practice →
3 Designing for Testability 3 lessons · 1 practice 0 of 4
Lesson 1 · 6:36Hard to Test Means Badly Designed
6:36
Hard to Test Means Badly Designed
Video · 6:36
Watch lesson ▶
Lesson 2 · 6:43Injection, Seams and Protocols
6:43
Injection, Seams and Protocols
Video · 6:43
Watch lesson ▶
Lesson 3 · 6:24Pure Cores and Humble Objects
6:24
Pure Cores and Humble Objects
Video · 6:24
Watch lesson ▶
Practice · 0 of 35 questionsModule practice
Module practice 0 of 35 for the certificate
Answer 35 questions
This module has 70 questions; 35 count toward the certificate.
Practice →
4 Test Doubles & Testing Async Code 3 lessons · 1 practice 0 of 4
Lesson 1 · 6:43Stubs, Spies, Fakes and Mocks
6:43
Stubs, Spies, Fakes and Mocks
Video · 6:43
Watch lesson ▶
Lesson 2 · 6:20Testing Async and Actors
6:20
Testing Async and Actors
Video · 6:20
Watch lesson ▶
Lesson 3 · 6:26Deterministic Time, No Sleeps
6:26
Deterministic Time, No Sleeps
Video · 6:26
Watch lesson ▶
Practice · 0 of 35 questionsModule practice
Module practice 0 of 35 for the certificate
Answer 35 questions
This module has 70 questions; 35 count toward the certificate.
Practice →
5 Refactoring, Legacy Code & Suite Health 3 lessons · 1 practice 0 of 4
Lesson 1 · 6:46Refactoring Under a Green Suite
6:46
Refactoring Under a Green Suite
Video · 6:46
Watch lesson ▶
Lesson 2 · 6:30Taming Legacy Code
6:30
Taming Legacy Code
Video · 6:30
Watch lesson ▶
Lesson 3 · 6:51Suite Health: Flakiness and Coverage
6:51
Suite Health: Flakiness and Coverage
Video · 6:51
Watch lesson ▶
Practice · 0 of 35 questionsModule practice
Module practice 0 of 35 for the certificate
Answer 35 questions
This module has 70 questions; 35 count toward the certificate.
Practice →

Tips

See all