2011-11-05 4 views
3

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"); }

このテストでは、私のプロジェクトに失敗しました。私のロジックテストはうまく動作します。

答えて

3

私の悪い、私はあまりにも早く話しました。私はthis solutionを試して、それが動作します。言い換えれば、私は今iOSシミュレータの中からロジックテストとアプリケーションテストの両方を実行できるようになりました。

テストターゲットのビルド設定にbundle loadertest hostの両方のパラメータを設定してください。

関連する問題