Unit Testing in iOS

Learn how to write unit tests for your iOS app and increase your confidence in deploying stable code in production.

Course Requirements

  • Xcode 13, Swift 5.5, macOS Big Sur 11.3 or later

What You'll Learn

  • Unit Testing Concepts

    Learn about what a unit test is, what makes a good unit test, what is a good amount of code coverage and more.

  • XCTest Framework

    Learn how to use Apple’s native testing suite: the XCTest framework. Learn what a test case is, how to assert expectations, and how to set up and tear down each test to make sure each test runs in a neutral environment.

  • Writing Unit Tests

    Learn how to add a testing target to new or existing projects, and learn how to write unit tests using a simple given-when-then method.

  • Mocking Network Requests

    Learn how to create mocks by refactoring code to make it more testable. Learn the differences between mocking, stubbing, and faking.

  • Test Driven Development

    Learn how to do test-driven development, what the red-green-refactor methodology is, and practice how to do it in sample projects.

  • Unit Testing Best Practices

    Learn why unit tests should be independent and shouldn’t rely on other tests or external sources. Learn what the best practices are when writing unit tests.

Why This Course?

  • Increase App Stability

    Writing unit tests ensures that features you implement will behave correctly as expected and it increases stability by preventing or lowering chances of regression.

  • Confident Deployments

    Unit tests ensure that merging features don’t break existing functionality (regressions), and this increases confidence that the software you deploy is stable (and less prone to bugs).

  • Effective Development Processes

    Unit testing promotes better development processes by ensuring code quality by continuous refactoring and reducing potential bugs and errors by catching them early during development.

Course curriculum

    1. Welcome

    2. Resources

    3. Where to Get Help?

    1. Lesson 01: Getting Started with Unit Testing in iOS

    2. Lesson 02: Writing a Simple Unit Test

    3. Lesson 03: Mocking a Network Request

    4. Lesson 4: Writing the Unit Test

    5. Lesson 5: Test Driven Development

About this course

  • Free
  • 8 lessons
  • 1 hour of video content

Get Access to this course with a CWC+ Membership

With a membership, you'll get access to all of our programs, structured learning paths and training courses to help you become an iOS developer or indie app developer.

Learn More