Unit Testing Swift Mobile App

Apply Test-Driven Development(TDD) process to iOS mobile app development in Swift
Unit Testing Swift Mobile App
File Size :
3.06 GB
Total length :
8h 42m



Sergey Kargopolov


Last update




Unit Testing Swift Mobile App

What you’ll learn

Unit Test iOS Mobile App
XCTest Framework
Create, Run and Debug Unit Tests
Mock Dependencies
Use Dependency Injection
UI Testing

Unit Testing Swift Mobile App


Knowledge of Swift
Mac OS and Xcode


Unit Testing is a must-have skill and this video course is about Unit Testing Swift code. If you take this video course, you will learn how to follow a Test Driven Development process to implement a feature for an iOS mobile app built with Swift.   This video course starts with Unit Test basics and continues with a very practical set of lessons that demonstrates how to follow a Test-Driven process to implement the User Signup feature in the Model View Presenter mobile app.By the end of this video course, you will have a very clear understanding of how to write Unit Tests and UI Tests for your Swift mobile application, and you will be able to test even very complex Swift code. If you are a freelance developer you might postpone learning how to unit test iOS app for some time. But if you are planning to join a bigger team, then unit testing is a must-have skill for you to be able to work on important app features.Have a look through the curriculum of this course to see what it covers. Watch a few sample video lessons. And if you have questions, I am always here to help you.


Section 1: Introduction

Lecture 1 Source Code

Lecture 2 Introduction

Section 2: Basics of Unit Testing in Xcode

Lecture 3 Introduction

Lecture 4 Testing Pyramid

Lecture 5 The F.I.R.S.T Principle

Lecture 6 Test-Driven Development Lifecycle

Lecture 7 Enable Unit Tests in Xcode Project

Lecture 8 The Default Unit Test Case Class Explained

Lecture 9 The addTeardownBlock()

Lecture 10 Creating a New Test Case Class

Lecture 11 Ways to Run Unit Test in Xcode

Lecture 12 The Default Order of Unit Tests

Lecture 13 Unit Test Naming Requirements

Lecture 14 Ways to Disable or Skip Unit Test

Lecture 15 Viewing Test Results

Lecture 16 Code Coverage

Lecture 17 100% Code Coverage

Lecture 18 Test Method Code Structure. Arrange, Act, Assert.

Lecture 19 Assertions

Lecture 20 Enabling the Failure Debugger Breakpoint

Lecture 21 Parallel Distributed Testing on Multiple Simulator Clones

Section 3: TDD. Implementing Model Validator

Lecture 22 Introduction

Lecture 23 Test That User First Name is Valid

Lecture 24 Test for a very short First Name

Lecture 25 Test for a very long First Name

Lecture 26 Challenge: Apply TDD to Implement Validation of Last Name and Email Address

Lecture 27 Test if user passwords match

Lecture 28 Test if user passwords do not match

Section 4: Test Code in Isolation

Lecture 29 Introduction

Lecture 30 Dependency Injection

Lecture 31 Use of Protocols

Lecture 32 Test Toubles – Fake, Mock, Stub, Dummy

Section 5: TDD. Implementing Network Service Class.

Lecture 33 Introduction

Lecture 34 Create Initial SignupWebServiceTests Unit Test class

Lecture 35 Create Initial SignupWebService Class

Lecture 36 Implementing SignupFormRequestModel

Lecture 37 Adding CompletionHandler to Signup Method Signature

Lecture 38 Implementing the Initial SignupResponseModel

Lecture 39 Implementing the Initial SignupErrors Enum

Lecture 40 Organize Project Folders

Lecture 41 Assert that the Response Status is Equal to “ok”

Lecture 42 Adding an Expectation and an Asynchronous Wait Method

Lecture 43 Inject URL String

Lecture 44 Prepare URL

Lecture 45 Prepare URL Request Object

Lecture 46 Create DataTask

Lecture 47 Inject URLSession

Lecture 48 Return Response Model

Lecture 49 Trying how it works with Real HTTP Request

Lecture 50 Mock URLProtocol

Lecture 51 Make URLSession use MockURLProtocol

Lecture 52 Handle Unknown JSON Response Model

Lecture 53 When Empty URL Provided Return a Specific Error Message

Lecture 54 Refactor SignupErrors Enum

Lecture 55 Test URL Request Failure

Lecture 56 Check Code Coverage

Section 6: TDD. Implementing Presenter Class in MVP Application

Lecture 57 Introduction

Lecture 58 Create Presenter Unit Test Class and Test Method

Lecture 59 Create Signup Form Model Struct

Lecture 60 Create SignupPresenter class and the processUserSignup() method

Lecture 61 Create Initial MockSignupModelValidator class

Lecture 62 Create Validator Protocol

Lecture 63 Inject Validator Mock and validate each property

Lecture 64 Refactor

Lecture 65 Unit Test to verify the signup() was called

Lecture 66 Create SignupWebService Mock Class

Lecture 67 Signup Web Service Protocol

Lecture 68 Inject Signup Web Service Mock in to Presenter

Lecture 69 Unit Test to assert that Presenter calls a method on View Delagate

Lecture 70 Create View Delegate Protocol and MockSignupViewDelegate

Lecture 71 Inject View Delegate into Presenter

Lecture 72 Counting number of times a method was called

Lecture 73 Verify that successfulSignup() called one time only

Lecture 74 Refactor

Lecture 75 Coding Challenge

Lecture 76 Assert that Presenter calls a Error Handler on View Delagate

Lecture 77 Review Code Coverage of Presenter Class

Section 7: Unit Testing View Controller

Lecture 78 Introduction

Lecture 79 Create a New Test Class and a Test Method

Lecture 80 Test UITextFields are initially empty

Lecture 81 Test UITextField has a referencing outlet

Lecture 82 Test UIButton has @IBAction assigned to it

Lecture 83 Test UIButton Action invokes code in Presenter

Lecture 84 Create MockSignupPresenter class

Lecture 85 Inject MockSignupPresenter into View Controller

Section 8: Testing Old or Legacy Code

Lecture 86 Introduction

Lecture 87 Refactor Massive View Controllers

Lecture 88 Use Protocols and Dependency Injection

Lecture 89 Adding code to existing methods

Lecture 90 Break large functions into smaller ones

Lecture 91 Wrapping existing classes. Decorator pattern.

Section 9: Examples: Ways to Load UIViewController in a Unit Test

Lecture 92 Loading UIViewController that uses a Storyboard

Lecture 93 Loading UIViewController that uses XIB

Lecture 94 UIViewController that creates Views programmatically

Section 10: Examples: Testing methods that throw Error

Lecture 95 XCTAssertThrowsError example

Lecture 96 XCTAssertNoThrow example

Lecture 97 An example of Do Try and Catch instead of XCTAssertThrowsError

Lecture 98 An example of Do Try and Catch instead of XCTAssertNoThrow

Section 11: Examples: Unit Test UITextField Attributes

Lecture 99 Overview of UITextField Attributes: Content Type, Keyboard Type, Placeholer…

Lecture 100 Test that UITextField has the Email Address UITextContentType set

Lecture 101 Test that UITextField has Email Address keyboard type set

Lecture 102 Test that Password UITextField is a Secure Text Entry

Section 12: Examples: Testing Navigation. Push to Navigation Stack.

Lecture 103 Project overview

Lecture 104 Push UIViewController into UINavigationController. Wait for expectations.

Lecture 105 Test Push Navigation. Alternative way.

Lecture 106 Test Push Navigation with Spy class

Section 13: UI Testing

Lecture 107 Introduction

Lecture 108 Accessing UI Elements

Lecture 109 Add UI Tests target to a project

Lecture 110 Create a new UI Test case class

Lecture 111 Recording UI Tests. An introduction

Lecture 112 Recording UI Tests. Test if UITextFields are enabled

Lecture 113 Testing with UITextField placeholders

Lecture 114 Test Assertions to check if UITextFields are enabled

Lecture 115 Adding accessibility identifiers to UITextFields

Lecture 116 Finding UI elements

Lecture 117 A Test method to assert that an error alert is presented

Lecture 118 Making UIViewController display UIAlertController

Lecture 119 Refactor

Lecture 120 Test for Success Alert Dialog

Lecture 121 Wait for View Controller to appear

Lecture 122 XCUIElement Actions and Gestures

Section 14: UI Testing. Screenshots & Attachments.

Lecture 123 Introduction

Lecture 124 Generating and Previewing Screenshots

Lecture 125 Enabling and Disabling Automatic Screenshots

Lecture 126 Taking Screenshot of Specific UI Element

Lecture 127 Take a Screenshot of Current Device Screen

Section 15: UI Testing. Launch Arguments.

Lecture 128 Introduction

Lecture 129 Passing and Reading Launch Arguments

Lecture 130 Passing and Reading Launch Environment Values

Section 16: UI Testing. Test Plans.

Lecture 131 Introduction

Lecture 132 Creating a new Test plan

Lecture 133 Creating new test plan configuration

Lecture 134 A separate Test Plan for UI Tests, Unit Tests and All Tests

Lecture 135 Localization screenshots demo

Section 17: Bonus section

Lecture 136 Bonus lecture

Beginner Swift developers with no experience with Unit Testing

Course Information:

Udemy | English | 8h 42m | 3.06 GB
Created by: Sergey Kargopolov

You Can See More Courses in the Developer >> Greetings from CourseDown.com

New Courses

Scroll to Top