
Explore test driven development in iOS with Swift, covering what testing is, why and when to test, unit and UI testing, core domain logic with a tip calculator, and mocking.
Ensure swift basics—constants, closures, functions, classes, structs, loops, arrays, and mapping—plus declarative ui framework knowledge. The course focuses on test driven development using the mvvm pattern, with mvvm resources provided.
Download and use the exercise files as resources for the projects you'll work on, run the code, and consult the lectures to better understand the implementation.
Discover what TDD means in iOS development and how tests guide your app architecture by starting with a failing unit test, then making it pass and refactoring.
Learn why test driven development provides confidence to change code safely, enables automated user interface testing, and guides architecture by revealing missing functions and guiding decisions.
Focus on testing domain logic with unit tests in test driven development, avoid testing generated code or dependencies, and automate user interface tests as you move toward behavior driven development.
Use test driven development for medium to large projects, greenfield work, and when learning a domain by writing tests; in brownfield work, add tests but skip unit testing in hackathons.
Developers must own unit tests; TDD is a long-term investment that creates a safety net by catching issues before production.
Identify and avoid bad unit tests, and craft business-focused, independent, automatic, repeatable, readable tests with a clear goal that support a story and encourage refactoring.
Focus on implementing the tip calculation domain logic with test driven development, creating a model that computes tips for amounts and selected percentages, while the user interface remains separate.
Learn to set up a tip calculator unit test project with a unit testing bundle using XCTest, write test functions starting with test, and validate logic with XCTAssertEqual.
Learn test driven development by writing a tip calculator unit test that defines a calculate tip function using total amount and tip percentage.
Develop unit tests for a tip calculator to handle negative input by throwing an invalid input exception, convert the calculate function to throw, and prepare for UI integration.
Create a tip calculator instance, call calculate with the entered amount and percentage, format the result as currency, and handle errors with do-catch in a test-driven SwiftUI app.
Learn how to set up a user interface test project in Xcode for the tip calculator, including adding a UI testing bundle target and differentiating UI tests from unit tests.
Write ui tests to verify the content view shows a default total and the 20% tip is selected by default, using accessibility identifiers for text fields and segmented controls.
Refactor tests by using setup and teardown to initialize and launch a fresh iOS app instance before each test, reducing repetition and ensuring test independence.
Learn to write a UI test that enters a total, taps the calculate tip button, and verifies the tip via accessibility identifiers, waiting for existence in a SwiftUI iOS app.
Learn to write ui tests for invalid total input in an iOS Swift app, including negative totals, accessibility identifiers, and using a page object pattern to reduce test duplication.
Learn to implement the page object pattern in iOS tests by creating a content view page that exposes the total text field, tip percentage segmented control, and calculate button.
Explore recording UI tests in Xcode for a tip calculator, learn how to capture interactions and access elements, and then refine the generated code due to tool bugs.
Code coverage measures the percentage of code under test, illustrated by a bank account with withdraw and deposit functions; 100% coverage doesn't guarantee bug-free code, so cover core domain logic.
Learn to enable code coverage in Xcode and validate a bank account model with unit tests for deposit, withdrawal, and insufficient funds, achieving 100% domain layer coverage.
Master mocking by replacing real network calls with a mock service. Use mocks in unit and UI tests to simulate authentication and navigation to the welcome screen.
Run the starter iOS app, observe login validation and server interaction, and learn to mock a web service for UI tests to keep tests independent from external dependencies.
Add a UI test target and write a test that launches the app, leaves username and password blank, taps login, and asserts the required fields are missing.
Master test driven development in iOS using Swift by writing a UI test that verifies authentication navigates from login to the dashboard, while introducing mocked services.
Create a network service factory that returns a mock in test environment and a real web service otherwise, injecting into the login view model for offline unit testing.
Write a test to verify that invalid credentials trigger an 'invalid credentials' message after tapping login button, while introducing the page object design pattern for UI access and domain TDD.
Implement the page objects design pattern to clean up tests by encapsulating login page elements—username and password fields, login button, and message text—and enable independent tests with mocks.
Explore end-to-end testing of a simple to-do list iOS app that persists tasks to a core data sqlite database, highlighting title, body, priority, and the favorite feature.
Create an end-to-end user interface test to verify that on first launch no tasks appear, then saving a task persists in the real core data SQLite database without mocking.
Learn to delete the app before each test using a Springboard utility to remove the to do app and its sqlite database, ensuring a fresh end-to-end test.
Write and run an end-to-end test that prevents saving duplicate to-do task titles by verifying a case-insensitive check, database save, and a 'task is already added' message.
Write a test to verify that deleting a task works by adding a task, swiping left to reveal delete, tapping delete, and asserting the task is removed from the list.
Develop and validate an end-to-end test that updates a task from not favorite to favorite, verifying the heart icon and accessibility identifiers while ensuring isolated, real-data tests start from scratch.
Explore the quiz app architecture by separating concerns into view, view model, model, and DTOs, and connect them to a Glitch-based Node and Express server for JSON data.
Explore the starter project for the quiz app, review the Node Express server on Glitch.com with hardcoded quizzes, and identify missing core domain logic for scoring and grading.
Explore test driven development by writing a unit test that verifies quiz total points are calculated correctly from questions. Map quiz DTOs from JSON to domain models and compute totals.
Write and run tests to grade an exam by score, implement a calculate letter grade function, and validate score-based outcomes such as 90+ yielding A and 72 yielding B.
Implement a unit test to grade a quiz submission in iOS using Swift, building a quiz submission model and a grade function that yields A, B, or F.
Write UI tests to display the available quizzes using a mock network service to avoid real network calls, and verify navigation from the quiz list to the question list screen.
Tap a quiz from the quiz list to navigate to the question screen and display the three questions. Ensure submission shows a warning when not all questions are answered.
Test-driven development in iOS using Swift: verify that submitting a quiz with no answers triggers an on-screen error message, using accessibility identifiers and waiting for the submit button to exist.
Write tests to verify that submitting a quiz navigates to the grading screen and displays the calculated grade; implement a grade view model to expose the score.
Apply test driven development by writing unit tests for your domain layer, mock only external services like network or pedometer with hardcoded data, and test to satisfy business value.
As a software developer you must always aspire to write quality code. You must also make sure that any future code you write does not break existing features. Test Driven Development provides you with a great way to implement software. It provides a safety net, which allows you to make changes with confidence. In this course, you will learn how to apply the principles of test driven development in iOS using Swift language.
Let’s check out the contents of the course:
Understanding Test Driven Development
In this section you will learn about the concepts behind Test Driven Development. You will learn why testing is important, when to write unit tests and even misconceptions behind testing in software development.
Types of Testing
In this section you will learn about types of testing. You will learn the differences between unit testing, user interface testing, integration testing, acceptance testing and performance testing.
Writing Your First Unit Test
In this section you will learn how to write your first unit test. We will implement a simple Tip Calculator and write your code using the principles of test driven development. You will learn how using test driven development allows you to architect your app.
Writing UI Tests
In this section you will learn how to write user interface tests. You will learn how to automate your user interface and perform actions on the elements on the screen. You will also learn how to use the PageObject pattern to reuse elements from the screen.
Mocking
In this section you will learn the concept of mocking. You will learn how to create a mocked version of the login service, which will allow the user to continue with their tests without having a dependency on a real login service and network connection.
End to End Testing
In this section you will learn how to perform end to end integration testing. You will learn how to invoke a real network service and make sure that all components of the app are working correctly together.
Project Time - Quiz App
Finally, you are going to put all your skills to test by implementing a Quiz App in SwiftUI using the principles of test driven development. You will start by testing the core domain and then move on to write user interface tests.
Who is this course for?
Developers interested in learning about writing great software based on the principles of test driven development.
Developers interested in learning about the application domain using unit tests.
Developers who want to educate themselves on how to architect an application using test driven development.
Developers who want to take their skills to the next level
I had so much fun in creating this course and I really hope you enjoy it too.
Thanks and let’s start coding!