Learn how to test your Objective-C exercises on Exercism
Exercism will only download a test file. You will need to manually create the header and the source file associated with the exercise. You will need to generate an Xcode Project file with the test file, the header file (.h) and the source file (.m). Alternatively, you can use a test runner utility that's described below.
Tests will be run through Xcode.
Note: If you receive the error "No visible
@interface for ExerciseName declares the selector ExerciseSelector," you followed the steps correctly, but haven't written anything in your header/implementation file(s). After you declare your method in the .h file and define it in the .m file, your tests should raise more helpful errors that will lead you towards completing the exercise. Read this primer on Objective-C Classes for more in-depth information.
An alternative to manually generating the project file is to use a test runner utility written in ruby,
objc, that will create a project file for you with the test file, header file and source file.
$ gem install objc
Run the tests with:
$ objc -x ExerciseName
--xcodebuild flag, which specifies using
xcodebuild instead of
xctool. The latter does not work with Xcode's latest releases.)
The objc utility uses the exercise name to find the test file,
ExerciseNameTest.m, the header file,
ExerciseName.h and source file
ExerciseName.m. The files are inserted into a temporary Xcode Project and then
xcodebuild is used to run the tests for the project.
objc makes it so you never have to launch Xcode to complete these exercises, the error messages and feedback through the command-line are not as clear as through the Xcode user interface.