How to Mock and Stub a System Class in Swift: Part 1


Speed and reliability are key elements of a robust test suite. But for a test suite to be fast and reliable, you need to be in control of the environment in which the test suite is run. You don't want to write a unit test that depends on the response of an API request. Right? For such a unit test to be fast and reliable, the API your application interacts with needs to be mocked and its response stubbed.

What Are You Testing


A few days ago, I wrote about unit testing private methods in Swift. I briefly touched on a topic that is very often overlooked by developers, especially those that are new to unit testing. What are you testing?

How to Unit Test Private Methods in Swift


Unit testing a Swift project is quite different from unit testing a project written in Objective-C. For those that are used to the flexibility of the Objective-C runtime, it may feel as if your hands are tied behind your back.

Write Better Code By Writing Unit Tests


Even though writing unit tests is not my favorite aspect of software development, over the years, I have come to enjoy and appreciate it. Not only is a robust test suite invaluable for any software project, it also makes you a better programmer.

How To Enable Code Coverage In Xcode


One of the announcements that excited me most during last year's WWDC was Xcode's built-in support for code coverage. As of Xcode 7, you no longer have to jump through a bunch of hoops to find out how well your test suite has covered your code.

About Bart Jacobs

About bart jacobs

My name is Bart Jacobs and I run a mobile development company, Code Foundry. I've been programming for more than fifteen years, focusing on Cocoa development soon after the introduction of the iPhone in 2007.

Stop Writing Swift That Sucks

In my free book, you learn the four patterns I use in every Swift project I work on. You learn how easy it is to integrate these patterns in any Swift project.