Unit Testing in Swift

1 Year Subscription

The first time when someone hears the word testing, it feels scary. Although, tests help you be confident in the code you write and they are a benefit in the long term. Assume you’re in a team working on an app. Someone mistakenly interchanges some data, and that was missed during manual testing. A user complains about mock data in the app. And another user sends you this feedback, and such messages bombard your inbox.

Imagine writing a simple unit test to check such manual errors and alert you before release. Easy, right?

In this introductory article about testing and unit testing, we’ll cover the following:

  • Why to test?
  • What to test?
  • What is unit testing?
  • Understanding XCTest and XCTestCase
  • Adding a unit test in Xcode
  • Another unit test example
  • Tips for naming
  • Debugging a test
  • Enabling code coverage
  • Automating with Fastlane and Semaphore

Why to test?

As a software developer, you want to make sure that the code you are writing is working the way it is supposed to….



UCSD DevOps CICD

Continue reading on source link

Leave a Comment

Your email address will not be published. Required fields are marked *

89 − 81 =