0

Apple's "iPhone Development Guide" suggests on page 62 that "Because application tests run only on a device, you can also use these tests to perform hardware testing...".

I'd like to run my OCUnit test cases in the simulator as well -- but haven't figured out how to do that. Is it possible? Or do I have to use Google's toolkit instead? http://code.google.com/p/google-toolbox-for-mac/

Quinn Taylor
  • 44,553
  • 16
  • 113
  • 131
Vik
  • 1,301
  • 4
  • 16
  • 29

4 Answers4

1

Took a day of digging around, but it appears that OCUnit does not allow tests on the simulator but on device only. Google Toolkit for Mac is better suited for testing on the simulator: http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting

Vik
  • 1,301
  • 4
  • 16
  • 29
0

Once you add UnitTestBundle to your application open its Info(getinfo) and in other linker flags change Cocoa to Foundation, after your change other linker flags should like this

-framework Foundation -framework SenTestingKit

HTH

JSK
  • 105
  • 1
  • 7
0

XCode 4.1 will let you run logic tests in the simulator using the "Test" scheme, but application tests will fail because won't be able to get an instance of your UIApplicationDelegate.

XCode 4.1 won't allow you to run logic tests on device. It gives you the following error:

Logic Testing Unavailable Logic Testing on iOS devices is not supported. You can run logic tests on the Simulator.

Heath Borders
  • 30,998
  • 16
  • 147
  • 256
-2

As of XCode 4 and iOS 4, application tests can run on both device and simulator.

Mads Mobæk
  • 34,762
  • 20
  • 71
  • 78
  • 1
    Application tests fail in the simulator. My UIApplicationDelegate returns `nil` on the simulator, but non-`nil` on the device. – Heath Borders Aug 26 '11 at 20:32