
Explore unit tests with tdd on a bank account (deposit, withdrawal, insufficient funds fee), then mock the credit score for April rate, and test SwiftUI logic and end-to-end UI.
Download the starter project in Swift Testing Essentials to get the folder structure and starter code, and access exercise files and resources by lecture for easy setup.
Explore test driven development, the testing pyramid, and practical unit, mock/stub, UI, and service testing for iOS. Learn to write tests first and gain a safety net against regression.
Learn how to add unit and UI testing targets to a SwiftUI app by using the project editor, selecting Swift testing or XC test, and configuring test bundles.
Explore the starter project and learn to add unit and UI testing in Swift. Understand the app’s structure, including social security number validation and the credit score service for tests.
Demonstrates test-driven development for bank deposits by check or cash, verifying that deposits increase balance, and introduces parameterized tests to cover both deposit types in Swift.
Adopt the arrange, act and assert pattern to structure tests, arranging setup, using a single line for the act, and allowing multiple assertions.
Explore test driven development by verifying transfer deposits incur a 2% fee, calculate the net balance, and update tests as fees may change.
Enable audible cues for test results by configuring Xcode to play sounds on success and failure, using breeze for success and an error tone for failures.
Explore how depositing a negative amount triggers an invalid amount error, and implement tests that expect the error and update the deposit function accordingly.
Explore implementing withdrawal with insufficient balance that incurs a penalty, calculating overdraft amounts, and adding tests to verify balance updates and penalty logic.
Explore how depositing an amount updates the bank account's transaction history and ledger, and learn to unit test deposits, amounts, and transaction types (deposit vs withdrawal) to ensure correctness.
Develop and test an APR service that uses a third-party credit score to determine APR ranges from a valid SSN, and learn to replace calls with a stub or mock.
Implement a credit score protocol and a mock credit score service to replace the real third-party dependency in unit tests, enabling fast, network-independent testing with stubbed responses.
Implement APR calculation validation by ensuring the API throws a no credit score found error for SSNs with no credit score, via unit tests and a mock credit score service.
Learn to write Swift integration tests that verify the API service calls get credit score on the credit score service using mocks, confirmations, and expected counts to avoid false positives.
Learn how to prevent the API service from calling the credit score service for invalid SSN by validating the SSN format, using mocks and confirmations in integration tests.
Explore writing UI and end-to-end tests to verify APR results for a valid SSN using a UI test target and accessibility identifiers, with mocked API services.
Configure a credit score service via a factory that switches between mock and production based on a UI test launch argument, enabling reliable UI tests.
Demonstrates how to implement a UI test that displays an error message when a credit score is not found for a given SSN, including setup, input, and verification steps.
Set up a separate unit test target to validate the credit score service via its QA URL, testing valid and invalid SSNs and a 720 score, without mocks.
Test the logic inside views, including UI validation like SSN checks, and extract UI logic into a testable struct such as product filter state for unit tests.
Swift testing essentials: explore a large iOS development catalog at ASM Sharp School, with 160–180 hours of courses and hands-on three-hour workshops, including machine learning in iOS and Swift Data.
Testing is an essential part of building robust, maintainable, and high-quality iOS applications. Yet, many developers struggle with setting up a reliable testing strategy. Swift Testing Essentials: A Practical Guide is a hands-on course designed for developers of all experience levels who want to write effective tests with confidence.
This course takes a practical approach to testing, covering everything from Test-Driven Development (TDD) to stubs, mocks, UI testing, and view logic testing. You’ll learn when, what, and how to test different components of your app to ensure reliability and prevent regressions before they happen.
What You’ll Learn:
- The fundamentals of Test-Driven Development (TDD) in iOS
- How to use stubs and mocks for unit testing and dependency isolation
- UI testing strategies to verify user interactions and flows
- Techniques for testing view logic in SwiftUI
- Best practices for structuring tests and writing maintainable test cases
- Real-world testing workflows and common pitfalls to avoid
How This Course Will Benefit You:
- Increase Code Confidence – Write tests that catch bugs early and prevent regressions
- Improve App Stability – Ensure your app performs correctly across different scenarios
- Boost Productivity – Catch issues faster, reduce debugging time, and ship with confidence
- Write Maintainable Code – Learn test-friendly design patterns that make refactoring easier
- Master Real-World Testing Techniques – Apply practical skills to production-ready applications
Whether you're a beginner exploring iOS testing for the first time or an experienced developer looking to refine your testing strategy, this course will help you build high-quality, well-tested apps that stand the test of time.