yonaskolb / yonaskolb/XcodeGen

UI Test Scheme Executable Not Set

Open
#572 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
8.8k
Forks
908
Avg merge
17d 14h
Merged PRs (30d)
2

Description

I am trying to create a scheme/target that can execute/record UI tests. There is very little documentation on this. xcodegen doesn't quite generate the right scheme for this to work out of the box. Note: I do have unit tests that are running properly, but those unit tests don't have their own scheme.

Steps to reproduce:

  1. Create a Target with type of bundle.ui-testing:
  ScreenshotTool:
    platform: iOS
    type: bundle.ui-testing
    sources:
      - ScreenshotTool
      - fastlane/SnapshotHelper.swift
    settings:
      BUNDLE_LOADER: "$(BUILT_PRODUCTS_DIR)/Name_Of_Host_App.app/Name_Of_Host_App"
      LD_RUNPATH_SEARCH_PATHS: "$(inherited) @executable_path/Frameworks"
      SWIFT_VERSION: "4.0"
      TEST_HOST: "$(BUNDLE_LOADER)"
    dependencies:
      - target: Host_App_Target
  1. Create a scheme for that UI test
  ScreenshotToolScheme:
    build:
      targets:
        Host_App_Target: [run, test]
        ScreenshotTool: [test]
    run:
      config: Debug
      targets:
        Host_App_Target: all
    test:
      targets:
        - ScreenshotTool
    profile:
      config: AppStore
    analyze:
      config: Debug
    archive:
      config: AppStore
  1. Open the Scheme Editor in Xcode, and select the Run item

Expected
The "Host_App.app" should already be populated into the Executable dropdown field.

Actual
The Executable dropdown field shows "Ask On Launch"

Note
Looks like this is controlled in the xcscheme file for that UI test scheme. Under LaunchAction tag, it references the UI test target itself, not the host app. Once it's changed to the Host App, recording UI tests and running them works well. Problem is, running xcodegen will overwrite that xcscheme file.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the scheme YAML with the generated xcscheme file, focusing on the LaunchAction executable for a bundle.ui-testing target. Confirm how the host app is selected during generation, then verify that regenerating the project populates the host app instead of Ask On Launch and that UI test recording still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift, yaml
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.