I wrote the following tools, and continue to use the Swift ones regularly. See which ones might help you.

ApprovalTests logo

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:

  • Swift only
  • A powerful alternative to assertions
Screen shot: Baby Steps Timer

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?

  • Swift version
  • Objective-C version
Screenshot: Bowling Game slide

Bowling Game TDD Exercise

Learn Test-Driven Development by following the steps in this exercise, originally created by Robert Martin.


Blog posts:

  • Swift version
  • Objective-C version
Hamcrest logo

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 only
  • Assertions on steroids
  • Matchers are designed to be composable
Mockito logo

OCMockito

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


Blog posts:

  • Objective-C only
Paint by Numbers example

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.

  • Swift version
  • Objective-C version
Code Snippets

Test-Oriented Code Snippets

Code snippets to help you write test cases. Available to all new subscribers.

  • Swift
  • Objective-C
  • Xcode
  • AppCode
Emoji: Woman Sleuth

ViewControllerPresentationSpy

Unit test alerts, presented view controllers, and dismissed view controllers.


Blog posts:

  • Swift
  • Objective-C
XcodeCoverage logo

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:

  • Objective-C coverage only

XcodeWarnings

An xcconfig that enables lots of Xcode warnings.


Blog posts:

Custom XCTest templates

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:

  • Swift
  • Objective-C
  • Also works in AppCode
>