iOSシミュレータでアプリケーションテストを実行するXcode4の機能について混乱します。Xcode 4:iOSシミュレータでのアプリケーションテスト
一方、アップル独自のドキュメントによれば、アプリケーションテストはシミュレータで実行できます。もう一方で、私はここでフォーラムを読んできましたが、アプリケーションテストはデバイス上でしか実行できないという人はほとんどいません。
後者の場合は、これを文書化するリンクを含めてください。私は何かを見つけることができませんでした。とにかく
、iOS App Development Workflow Guide:Unit Testing Applicationsから:
Listing 6-2 Transcript of an iOS Simulator-based application unit-test run
とも
Note: Although Xcode can run logic and application unit tests in simulators, Xcode cannot run logic unit tests on devices. Therefore, if you include and have active both types of unit tests in a scheme, you will not be able to use that scheme to run unit tests on devices.
問題は、シミュレータがないということですUIApplicationDelegateへのアクセスを提供しません。ここではサンプルテストを実証することである。
- (void) testAppDelegate { id yourApplicationDelegate = [[UIApplication sharedApplication] delegate]; STAssertNotNil(yourApplicationDelegate, @"UIApplication failed to find the AppDelegate"); }
このテストでは、私のプロジェクトに失敗しました。私のロジックテストはうまく動作します。