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

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:

Mockito logo

Objective-C

OCMockito

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

Blog posts:

Swift Testing template by Jon Reid

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:

Code Snippets

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:

XcodeCoverage logo

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 TCR logo with hammer and checkmark

Xcode

Xcode TCR

  • Make some changes.
  • Run tests.
  • If the tests pass, it commits your changes.
  • If the tests fail, it reverts your changes.
  • Custom XCTest templates

    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

    Screen shot: Baby Steps Timer

    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?

    Screenshot: Bowling Game slide

    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

    “Refactor in Small Steps” part two

    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.

    >