-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to integrate into iOS unit test target #41
Comments
UI tests can't access application files - back to square one? |
Yea, UI Tests can't drive the mocks at this point. I'm not sure why you're encountering the errors you are, seems more like a Cocoapods issue. I wasn't using the nested layout above, but called it out more explicitly
|
Hmmm, strange, I get the exact same error with that pod file. What version of cocoapods are you using and does it compile/run correctly on your side? Also what are your have 'Host Application' and 'Allow testing Host Application APIs' set to in the test target? |
I've usually done Host Application. I also noticed there's an issue with the Pod and If this is blocking you, |
Hey @hhanesand , I updated the pod spec, can you give it another shot? It looks like there were a few issues that should be resolved. |
Hey @hhanesand -- I'm going to close this issue, re-open if you're still having a problem. |
I'm updating a project right now from CocoaPods 1.0.1 to 1.5.3 and seeing the same error message in the console that @hhanesand originally posted here. @KingOfBrian My Podfile looks a lot like the one you posted (though it's a bit more complex). Do you have any thoughts on why this might still be happening, even though you updated the podspec? |
@joshuatbrown are you sure the target isn't a UI Test? Are the Unit Tests "Hosted"? If you can post a podfile with names stripped out that might help figure out what's going on. |
@KingOfBrian Wow — thanks for the quick response. It's not a UI Test target, and I don't think the unit tests are "Hosted". The project is an iOS Framework, and the Podfile looks something like this:
I've also tried including the pods inside of the main target (called |
I was able to reproduce this with a sample project. It's here: https://github.com/joshuatbrown/RZBCocoaPods |
Thanks @joshuatbrown -- that's helpful! Unfortunately it looks like the Test sub-pod doesn't work correctly. It should really be generating it's own Framework that depends on RZBluetooth/Mock (Which should also be it's own framework). What's happening here, is when the test bundle is built, the RZBluetooth from the non-test-target is getting copied into the bundle and over-writing the RZBluetooth.framework with the Test sub-pod. I was able to get the tests to run by adding 'RZBluetooth/Test' to the main-target, but obviously that's not a good solution. I'm not able to generate a fix for this at this time unfortunately. To get your tests working, I recommend just copying RZBSimulatedTestCase and the helpers into your test target. That should un-block you in a reasonably clean way. I'm going to re-open this, and would appreciate help with a fix if you're interested in diving into the Podfile. Brian |
@KingOfBrian I may be able to help. Can you tell me more about what you mean by "diving into the Podfile"? I'm guessing you mean the |
I did some more digging and found an issue for this in CocoaPods. It was reported in CocoaPods 1.3.1, and seems unlikely that it will be fixed anytime soon. The latest word from the CocoaPods maintainers is that this is "outside the scope of subspec capabilities" and they recommend creating a separate Podspec for it. @KingOfBrian are you open to having a separate Podspec instead of a subspec for RZBluetooth/Test? |
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 :
A unit testing file:
Everything compiles just fine, but when running the test, it prints a message stating :
As you can see by the
Referenced from
andExpected in
lines, Xcode sees a symbol from theRZBluetooth
framework (_OBJC_CLASS_$_RZBSimulatedTestCase
) and expects it to be located in/tacx.app/Frameworks/RZBluetooth.framework/RZBluetooth
, which is the app's version ofRZBluetooth
(created bypod 'RZBluetooth/Mock'
in the podfile). This causes the app to crash because it can not find a the symbols forRZBSimulatedTestCase
.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
RZBSimulatedTestCase
class?The text was updated successfully, but these errors were encountered: