Tools by Jon Reid
These are the tools I’ve created for Apple developers. Many are testing tools. Some are exercises you can use to improve your skills in unit testing, TDD, and refactoring.
Tools

Swift XCTest
ApprovalTests.Swift
Approval Tests are an alternative to assertions. You’ll find them useful for testing objects with complex values (such as long strings), lots of properties, or collections of objects.
Blog posts:
- ApprovalTests for Powerful Assertions in Swift: How to Get Started
- How to Verify Objects (and Simplify TDD) using ApprovalTests.Swift
- How to Verify Arrays and See Simple, Clear Diffs using ApprovalTests.Swift
- Write Parameterized Tests in ApprovalTests.Swift by Transforming Sequences
- Like Magic: How to Wrangle Legacy Code with Combination Approvals

Mac apps
Disable/Enable Backup
Apps to disable/enable Time Machine backups.
⏳️
Swift XCTest, Swift Testing
Expect to Eventually Equal
An assertion for asynchronous code. For both XCTest and Swift Testing.
✖️
Swift XCTest, Swift Testing
FailKit
Write expressive custom assertions that work on either Swift Testing or XCTest.
📋
Git
Git Commit Message Template
Template to annotate commits with different risk levels using Arlo’s Commit Notation.

Objective-C
OCHamcrest
The Objective-C implementation of Hamcrest. It’s library of predefined matchers (which you can use in test assertions), and a framework for creating your own matchers.
Blog posts:

Objective-C
OCMockito
The Objective-C implementation of Mockito. It supports creation, verification and stubbing of mock objects.
Blog posts:

Xcode, Swift Testing
Swift Testing Template
Apple's Swift Testing template is better than what they give us for XCTest. Now let's improve it further with a custom file template.
Blog posts:

Xcode
Test-Oriented Code Snippets
Code snippets to help you write test cases. Available to all new subscribers. Includes:
- Swift Testing
- SwiftUI
- Swift UIKit
- Swift XCTest
- Objective-C
😎
SwiftUI
Testable View
TestableView improves SwiftUI unit testing by cutting through the clutter of boilerplate code, letting you zero in on what matters: your test's intent.
🕵🏽♀️
XCTest, Swift Testing
View Controller Presentation Spy
Unit test UIKit alerts, presented view controllers, and dismissed view controllers.
Blog posts:

Objective-C
XcodeCoverage
A simple way to generate reports of the Objective-C code coverage of your Xcode project. Generated reports include HTML and Cobertura XML.
Blog posts:

Xcode
Xcode TCR

Xcode, XCTest
XCTest Templates
Apple’s template fills test suites with cruft. By contrast, these test suite templates are sleek. They contain a single failing test, nothing else.
Blog posts:
Exercises

UIKit
Baby Steps Timer
A bad piece of code you can use for refactoring exercises, originally created by David Tanzer. Can you add tests, and clean up the code?

XCTest
Bowling Game TDD
Learn Test-Driven Development by following the steps in this exercise, originally created by Robert Martin.
Blog posts:
🌱
Swift XCTest
Many of One
Swift refactoring exercise to teach Many of One pattern.
🔎
Swift
Refactor in Small Steps
When you refactor, are you using small steps?
Blog posts:
✅
Swift
Refactor in Small Steps, Part Two
🔀
Swift UIKit
Refactoring View Controller
An iOS view controller with unit tests, so you can play with ways to refactor it.
Blog posts:

Swift or Objective-C
TDD Paint by Numbers
A “Paint by Numbers” TDD exercise originally created by Jeff Langr. We have provided the tests for you, all disabled. Your job is to do the rest: make the tests pass, then make your code clean. Sample solutions are provided.
