Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An evolving collection of unit tests I've been writing as I learn Objective-C and Cocoa.
Objective-C
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
CocoaLearningTests.xcodeproj
English.lproj
Tests
.gitignore
CocoaLearningTests_Prefix.pch
Info.plist
README.md
Rakefile
Tests-Info.plist
main.m
version.plist

README.md

Objective-C and Cocoa Learning Tests

This is an evolving collection of unit tests I've been writing as I learn Objective-C and Cocoa. It's a work in progress I started years ago when I began to develop for the Mac.

I call these "learning tests" for lack of a better description. These tests are the safe place I return to when I forget how to do something, or when I need to better understand methods or APIs I intend to use in production code. I followed a similar path when I learned Ruby, as described in this blog post.

Why?

The goal isn't to create a comprehensive test suite for Objective-C or Cocoa. I'm not trying to verify whether they work as advertised. Rather, I'm writing these tests to learn how things actually work. It's learning through exploration. Once nice side effect is winding up with an executable repository of knowledge; the test suite grows each time I learn something new.

If you're new to Objective-C, I hope you learn something interesting by reading through these tests. But you'll likely learn a lot more by writing tests to poke and prod language features you want to use. So please, by all means, fork these tests and make them your own!

Writing the Tests

This Xcode project makes use of the SenTest testing framework included in Xcode. You might want to start by having a look at AssertionsTests.m. It shows how all the common assertion macros work. In some of the tests I have duplicated initialization code to keep the test data localized and easy to reference. I'm ok with that.

Running the Tests

To run the tests in Xcode, select the "Tests" target and build it. To run the tests from the command line, run "rake".

Author

Mike Clark, mike@clarkware.com, Clarkware Consulting

Something went wrong with that request. Please try again.