Xcode 4.2: Application and Logic Unit Test Classes

November 30th, 2011

Filed under: Xcode | Be the first to comment!

In Xcode 4.2 when you add a new Objective-C test case class to your project and click the Next button, you will see a Test Type menu. This menu has two choices: Application and Logic. The menu determines the unit test Xcode adds in the class’s implementation file. If you choose Application, Xcode adds a […]


Xcode 4: Unit Testing 64-Bit Mac Apps

May 12th, 2011

Filed under: Mac Development, Xcode | Be the first to comment!

When unit-testing a 64-bit Mac application, make sure the class files you are testing (your application’s implementation files) are members of the unit testing target. You will get linker errors when building the unit testing target if the class files being tested are not members of the unit testing target. How do you make a […]


Xcode 4: Unit Testing Support

April 1st, 2011

Filed under: Xcode | 3 comments

Developers doing test-driven development with the Cocoa and Cocoa Touch frameworks will like the improved support Xcode 4 has for unit testing. When you create a project that uses the Cocoa or Cocoa Touch frameworks, such as a Cocoa or iPhone application, Xcode gives you the option to add a unit testing bundle to the […]


Using Xcode to Unit Test SDL Games Written in C++

November 23rd, 2010

Filed under: SDL, Xcode | Be the first to comment!

Suppose you’re using SDL to program a game. You’re writing the game in C++, and you want to write unit tests for your code. Your first instinct would be to use a C++ unit testing framework like googletest or UnitTest++. Your instinct would be correct on Linux and Windows, but the Mac version of SDL […]


googletest Xcode Tip

November 22nd, 2010

Filed under: Xcode | 4 comments

Make sure your application’s C++ source files are members of the unit testing target you created. If you don’t add your application’s C++ files to the unit testing target, you will get linker errors when your unit tests access your application’s classes. To add one of your application’s C++ files to the unit testing target, […]


Loading Files for Unit Testing in Cocoa

November 10th, 2010

Filed under: Cocoa | 1 comment

Adding files to your unit testing bundle helps when you’re unit testing file behavior or when you have a lot of test data. This post shows you how to load files from the unit testing bundle to help you unit test Cocoa applications. Before You Code The first thing you must do is get your […]


Locating the Unit Testing Bundle in Cocoa

October 19th, 2010

Filed under: Cocoa, Mac Development | Be the first to comment!

If you load test data from a file when unit testing a Cocoa application, you’ll need to access the unit testing bundle to find the file. Your first instinct might be to call NSBundle’s mainBundle: method. For a unit testing target, the main bundle¬†should be the unit testing bundle, right? Unfortunately, the mainBundle: method is […]