Skip to content

Unable to integrate into iOS unit test target #41

@hhanesand

Description

@hhanesand

I've been struggling for a while to integrate the testing library into a unit test target, but I haven't found a solution that works yet.

Given a pod file like the following :

platform :ios, '10.0'

use_frameworks!

target 'tacx' do
    
    pod 'RZBluetooth/Mock'
    
    target 'tacxTests' do
        inherit! :search_paths
        pod 'RZBluetooth/Test'
    end

end

A unit testing file:

@import RZBluetooth;

@interface tacxTests : RZBSimulatedTestCase
@end

@implementation tacxTests
@end

Everything compiles just fine, but when running the test, it prints a message stating :

2016-11-20 19:05:59.112 tacx[95628:5961223] Failed to load test bundle from file:///Users/xxxxxxx/Library/Developer/Xcode/DerivedData/tacx-ghqgcpxbcphxnmhievkvngfndhzq/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/tacx.app/PlugIns/tacxTests.xctest/: Error Domain=NSCocoaErrorDomain Code=3588 "dlopen(/Users/xxxxxxx/Library/Developer/Xcode/DerivedData/tacx-ghqgcpxbcphxnmhievkvngfndhzq/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/tacx.app/PlugIns/tacxTests.xctest/tacxTests, 265): Symbol not found: OBJC_CLASS$_RZBSimulatedTestCase
Referenced from: /Users/xxxxxxx/Library/Developer/Xcode/DerivedData/tacx-ghqgcpxbcphxnmhievkvngfndhzq/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/tacx.app/PlugIns/tacxTests.xctest/tacxTests
Expected in: /Users/xxxxxxx/Library/Developer/CoreSimulator/Devices/D4A4BA5A-3023-4B18-B912-EE1FCDA1835D/data/Containers/Bundle/Application/2060D194-B119-4FEA-A8B1-917686855AB4/tacx.app/Frameworks/RZBluetooth.framework/RZBluetooth
in

As you can see by the Referenced from and Expected in lines, Xcode sees a symbol from the RZBluetooth framework (_OBJC_CLASS_$_RZBSimulatedTestCase) and expects it to be located in /tacx.app/Frameworks/RZBluetooth.framework/RZBluetooth, which is the app's version of RZBluetooth (created by pod 'RZBluetooth/Mock' in the podfile). This causes the app to crash because it can not find a the symbols for RZBSimulatedTestCase.

Are you aware of any way to explicitly importing the unit test's version of the library? (that is the version of the library that contains the RZBSimulatedTestCaseclass?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions