Skip to main content


Writing unit testing is a cornerstone of software development.  When developing mobile or desktop applications, unit testing becomes even more critical, as there is often vital business logic that needs to be validated.  Have you ever found yourself wondering; what makes a great unit test in Swift? What key components give my application enough testing coverage to make sure that everything works and nothing regresses when new code is added to my project?  If you have asked yourself these questions then you are not alone.  In fact, that is why I wanted to write this tutorial.

In my opinion one of the most overlooked features of the Xcode SDK is the ability to test UI input using XCTestCases.  Testing UI input throughout the lifecycle of your application can be beneficial for a multitude of reasons.  First, UI testing allows a developer to validate that given a specific set of input, the output is that the user interface will exist in a specific state.  Testing user interface output provides value because this allows a developer to test such states as loading data over the network or possib

This week I heard some chatter in certain iOS groups that I belong to about whether testing your iOS, macOS, watchOS, or tvOS applications provided any immediate value in the development life cycle.  As opposed to developing features without testing and getting them to market right away and then iterating upon them in a highly agile methodology.  Coming from a background where I like to write a lot of automated tests and system tests for software that I write, I have to admit, this point of view really made me pause for a moment to try and see the perspective from both sides.

One of the major parts of any software development cycle is testing.  Whether that testing is performed on just one feature or an entire product I think that any developer can agree that code and product functionality needs to be tested before it is deployed.  As a developer, one thing that I continuously find myself wondering is when is it an appropriate time to test my code?  I wonder if it cost effective and productive to perform testing on a feature by feature basis?  I wonder if I should wait until an entire section of features is completed to test functionality?