Skip to content

Problems with iOS test projects #408

Open
@igorkulman

Description

@igorkulman

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions