开发者

Does OCUnit allow application tests to be run on the iPhone Simulator?

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/


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


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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜