yonaskolb / yonaskolb/XcodeGen

Problems with iOS test projects

Open
#408 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Using the latest xcodegen from Homebrew in this repo https://github.com/igorkulman/iOSSampleApp/ (master branch) with the following config

name: iOSSampleApp
options: 
  createIntermediateGroups: true
  indentWidth: 2 
  tabWidth: 2 
  bundleIdPrefix: "sk.kulman"
  xcodeVersion: 0940
  groupSortPosition: top
targets:
  iOSSampleApp:
    type: application
    platform: iOS
    deploymentTarget: "11.0"
    sources:
      - path: iOSSampleApp
    dependencies:
      - carthage: RxSwift
      - carthage: RxCocoa      
      - carthage: Swinject      
      - carthage: SwinjectStoryboard      
      - carthage: CleanroomLogger      
      - carthage: SwinjectAutoregistration      
      - carthage: Reusable      
      - carthage: RxNuke      
      - carthage: Nuke      
      - carthage: FeedKit            
      - carthage: CRToast      
      - carthage: RxSwiftExt      
      - carthage: Defaults            
  iOSSampleAppTests:
    type: bundle.unit-test
    platform: iOS
    deploymentTarget: "11.0"    
    sources:
      - path: iOSSampleAppTests
    dependencies:
      - target: iOSSampleApp
      - carthage: Quick      
      - carthage: Nimble      
      - carthage: RxBlocking      
      - carthage: RxTest      
  iOSSampleAppUITests:
    type: bundle.ui-testing
    platform: iOS
    deploymentTarget: "11.0"    
    sources:
      - path: iOSSampleAppUITests
      - path: fastlane/SnapshotHelper.swift
    dependencies:
      - target: iOSSampleApp

Generates the main app OK but the unit tests and UI tests project are not building. I get

Undefined symbols for architecture x86_64:
  "protocol witness table for iOSSampleApp.RssSource : Swift.Equatable in iOSSampleApp", referenced from:
      closure #1 () -> () in closure #6 () -> () in closure #1 () -> () in iOSSampleAppTests.SourceSelectionViewModelTests.spec() -> () in SourceSelectionViewModelTests.o

trying to run the unit tests.

Looking at the generated iOSSampleAppTests scheme I see BUNDLE_LOADER = "$(TEST_HOST)" and no TEST_HOST.

When I change it to

BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/iOSSampleApp.app/iOSSampleAapp";
TEST_HOST = "$(BUNDLE_LOADER)";

as described in http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/ the tests start working.

Is it a bug? Or am I missing some setting in my config?

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 with the inline XcodeGen configuration and the generated iOSSampleAppTests scheme, focusing on BUNDLE_LOADER and the missing TEST_HOST. Compare the generated unit-test and UI-test target settings with the manual values that make tests build; done means both test projects build without post-generation edits.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift, yaml
Domain
build-system, mobile, testing-qa
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.