Buying for a Team? Gift This Course
Wishlisted Wishlist

Please confirm that you want to add Swift TDD - Test Driven Development for Swift no more bugs to your Wishlist.

Add to Wishlist

Swift TDD - Test Driven Development for Swift no more bugs

Prove your code is working every step of the way using a formalized test-driven development (TDD) process in Swift
3.0 (31 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
241 students enrolled
Created by Icaro Lavrador
Last updated 3/2016
$10 $200 95% off
1 day left at this price!
30-Day Money-Back Guarantee
  • 2.5 hours on-demand video
  • 2 Articles
  • 1 Supplemental Resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Have a coupon?
What Will I Learn?
Understand Test Driven Development (TDD)
Use apple unit test framework
Use appe UI test framework
Create and execute tests for Unit and UI
Create and execute code coverage
Create and execute code performance
View Curriculum
  • Students should know how to program in Swift and/or Object-C before start this course

Did you ever had that feeling that you fix one bug and it creates another two? Well it maybe because you are and you don't know because you are not adopting TDD

If you are already a Swift developer and want to be the best in the field this course is for you, Test Driven Development also known as TDD is a must have skill for any serious professional or anyone tired of expend precious time "hunting" for bugs.

Even the best programmer write bug codes, it is almost impossible to write the perfect code, even than, what work today may not work tomorrow, frameworks change, APIs change even the iOS every year we have a new one. Now how to find out if your old code is compatible with this new version? And if not what part isn't? Can you see how a little work before hand can make life much easier in the future?

TDD the concept of start development from the test phase, ensure that all the relevant parts of your code is tested, running the automated test ensure that the new changes you just made didn't create a bug in the old functions.

You may ask, but how really important is TDD? Until XCode 5 TDD was a optional check box when creating an app, in XCode 6 Apple decide that all apps should have TDD so they auto create the Unit tests for you (even if you didn't want to, good on you Apple).

Invest few hours now and few minutes while doing your applications and I promise you that you will save a lot of time and headaches in a short future, be it from clients that find that hidden bug, from your boss that give you long speeches every time one of your items get reopened or from your mother because that app you made to her for mothers day is crashing.

Who is the target audience?
  • You should take this course if you a iOS developer (Swift or Object-C)
  • You shouldn't take this course if you are a complete beginner as this is an advanced course
Students Who Viewed This Course Also Viewed
Curriculum For This Course
Expand All 23 Lectures Collapse All 23 Lectures 02:33:16
2 Lectures 04:53

What is TDD? Why should I learn it? How TDD is going to be beneficial to me? How is this course going to help me?

This and many more questions are answered in this lecture.

Preview 04:46

Before we start I want to get to know you a little better, let me know a little about you and your plans so I can direct this course and future courses to cover your preferences.

Before we start I really want to hear from you
Creating the Division App, Unit Test Extension, Test UI Extension and Basic UI
3 Lectures 16:05

In this lecture we will learn how to create an application with the proper Unit Test Extension and UI Test Extension

Creating the App with the Unit test Extension and UI Test Extension

In this lecture we will setup the UI using stack view and constraints so our app work across all different devices, it is very import to think about how the user is going to interact with our application since the begining don't matter how simple the application is.

Setup the UI using stack view and constrains

In this lecture we will be adding the IBOutlets from the Textfields and necessary Labels and also the IBAction from the calculate button

Adding the IBOutlets and IBActions
Test Driven Development - The basics
4 Lectures 19:45

Decoupled code is fundamental for testing, each piece of code should be responsible for one and only one thing, in this case CalculatorBrain Unit will be responsable to handle all the calculations for our application

Creating a Calculator Brain Unit

In this lecture we will see how to start our testing, what the XCode symbols and functions means and how we use it.

Basics about Unit Testing in XCode

In this class we will learn a some basic functions for test driven development. We will use XCTAsset to check the values passed to a function and write meaningful messages when this asserts are not as we expected.

Creating our first test case and implement our first function based on it

In this lecture we will check for nil values, there are many XCTAssert options to use equals, greater than, equals to, not equals to, less than and so on, you just need to find the one that suits best your needs.

XCTAssert, there are many they of them, lets check for nil values
Test Driven Development - Beyond the basics
4 Lectures 32:16

In this lecture we will see how to create and test completion blocks checking not just for one but for two different values. As we expect a Float to return nil and a specific error message to also be returned.

How to test completion blocks

In this lecture we will see how to measure the average time your function takes to execute and how to set (and reset) a baseline to comparison in the future

MeasureBlock, how fast or how slow is your function running

In this lecture we will learn how to add a new test Unit and make it accessible from the main project, we will also introduce a new class to hold the brains of our online calculator

New Online Class and Test Class

Sometimes test for the fail cases is almost more important (if not more) than test for the fail success cases, make sure that your functions are not returning unexpected values when it receives values out of range, or difference of expect is fundamental to keep your app running without any bugs.

Should it Pass or Should it Fails
Asynchronous Tasks how to handle it with Expectations
4 Lectures 39:27

In this lecture we will learn how to create an TDD call to the API call and request the result of the division.

Creating an Asynchronous call to the API service

Starting from iOS9 and OS10.11 a new security feature called App Transport Security (ATS) is available to apps and is enabled by default in any new app resulting to any attempts to connect using insecure HTTP to fail. In this lecture we will learn how to configure your info.plist with keys like NSAppTransportSecurity and NSAllowsArbitraryLoads to allow this connections again.

Allowing the app to make HTTP calls to the API

Some times errors can happen in asynchronous calls, that means that the test will finish before the result is back and the XCTAssert will never be executed. We can solve this using expectations, we can set expectations and wait for this expectations to be fulfilled, unfulfilled expectations result in unceseful tests.

When error happen in asynchronous call we may not see it

When errors happen asynchronous we need to set expectations and wait for this expectations to be fulfilled, in this lecture we will learn how to create this expectations, set a time so it can be fulfilled and how to add more tests as we need inside the expectations

Preview 08:15
Code coverage
1 Lecture 08:23

How to set it on and off, how to hide and show the results and how to read the reports that XCode generate for us

Code coverage
UI Testing
4 Lectures 32:26

So far the calculate button functionally has been empty, in this lecture we will read the values entered in the text fields, execute the calculations and add the results into the result label

Add functionality to the Calculate Button

In this lecture we will learn more about the UITest unit and add a simple test to check if we are in the main screen as we expected

First simple UI testing

In this lecture we will learn how to programatically find elements in the UI such as Text Fields, Labels, Buttons, we will also learn how to tap in this elements and type values in the keyboard

Entering Values in the TextFields, Tapping Buttons and Reading Labels (manually)

In this lecture we will learn how to use the "Record UI Test" in XCode so we can create the UI Testing just by use the app on the simulator and let XCode create the necessary code for us.

Recording the UI to generate the test "automatically"
Final test
0 Lectures 00:00

Show us how much did you learn in this course taking this quiz

Final test and training for an Interview
6 questions
Files and Resources
1 Lecture 00:03

All necessary files to create your app are in the download area of this lecture. This include the image used for the background and source code.

About the Instructor
3.9 Average rating
361 Reviews
3,562 Students
9 Courses
Swift Expert|Senior iOS Developer|Udemy Premium Instructor
  • I am an "eternal student", I start programing when I was just 10 years old and to this day I still learning new things every day.
  • Because of my passion in learn new things I developed a passion to teach as well, I start helping people at Stackoverflow where I am ranked as the top 10% Developer Help for Swift and top 20% Developer Help for iOS.
  • You will not see my name in many app as I am the go to guy to fix problems, I offer my work mainly as a contractor solving problem that the others professional cannot solve.
  • I start develop software and consultancy when I was 15 years old and never stop, today I want to help people because I read every day the code produced by the professionals in the field and I can honest say they are mostly JUNK.
  • One of my clients try to use an Udemy iOS course to argue about some strategies he took in his code. After see so many WRONG explanations, so many BAD advice I decide to create my own courses. I watch over 15 top rated courses at udemy and out before decide to take action
  • My courses are create to make YOU the best in the field, I can guarantee that if you take my courses you will drop jaws in interviews, companies are desperate looking for good developers and they will pay you over $100k/year to work for them.
  • But you have just one shot to impress, so make it the right one, learn right, learn it once, make money forever.
Report Abuse