LoginSignup
1
0

More than 3 years have passed since last update.

XcodeGenを使ってUI Testing Bundle (UIテスト用ターゲット) を追加する

Posted at

Product Typeに bundle.ui-testing を指定するとUIテスト用ターゲットを追加できます。
https://github.com/yonaskolb/XcodeGen/blob/master/Docs/ProjectSpec.md#product-type

project.ymlでUIテスト用ターゲットの定義と、メインのターゲットでのtestTargetの定義をすれば追加できます。

project.yml
targets:
  ExampleApp:
    type: application
    ...
    scheme:
        testTargets:
            - ExampleAppUITests
  ExampleAppUITests:
    type: bundle.ui-testing
    platform: iOS
    scheme: {}
    sources: ExampleAppUITests
    dependencies:
      - target: ExampleApp
    settings:
      INFOPLIST_FILE: ExampleAppUITests/Info.plist

ちなみにいきなり xcodegen コマンドで生成しても良いですが、テストクラス以外にInfo.plistが必要になります。
XcodeでUIテスト用ターゲットを通常通り作ってからXcodeGenで管理するようにしても良いと思います。

Product > TestCmd-U して、テストが実行されればOKです。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0