iOS UI Tests Linker Error - ios

I'm trying to run some UI tests for my iOS app. I was successfully able to record my UI tests, but when running them, I get a linker error:
I have a UI Testing Target added to my project, and my UI Test file has been added to that target.
I've already been able to write and run several Unit Tests without a problem.
Anyone know where I should look to solve this, or have a guess what the problem may be?
EDIT: The full log output shows that the UI test file can't import an SDK that my target app relies on.

For some reason, when I created my UITest target, a linker flag was added in the target that shouldn't have been there (-lMySDK).
Removing that flag resolved the linker error.

Related

What might be the reason of compiler errors when building iOS app for profiling?

When I build my application for running everything is fine, it builds without errors, runs smoothly,
while I build it for profiling I got Swift compiler errors, related to the Charts framework, for ex.:
swift:12:54: 'ChartViewDelegate' is unavailable: cannot find Swift declaration for this protocol
swift:13:32: 'BarChartView' is unavailable: cannot find Swift declaration for this class
Maybe the reason is in that how I added Charts framework?
I downloaded Charts project, build it and dragged & dropped the project bundle into xCode.
As a result I got in Frameworks group the following:
Charts.framework, Charts-Swift.h, Charts.h
Should I find files(within Charts project what I built separately) with classes that linker/compiler failed to recognize and add them into my project, or some additional project configuration is required?
Can you help me?
Update:
when in Settings/scheme I change Profile build configuration from Release to Debug - everything is ok.
And I build my application in Debug mode.
Is the same mode debug/release required for build of application to run and to profile?
You must add Charts.framework to every target of your project.
Let me know in the comments if this is the problem.

XCode UI Testing: Unable to find test runner app containing test bundle path

I have written UI Tests in XCode 7.3.1 on a dedicated target. I can record a UI test but if I try to launch it (all tests or a single one), I got the following error :
Unable to find test runner app containing test bundle path /Users/dle/Library/Developer/Xcode/DerivedData/Keecoach-exynmciqyehgmxcfxhkpksrqifsb/Build/Products/Debug-iphonesimulator/DemoKeecoachUITests-Runner.app/PlugIns/DemoKeecoachUITests.app
I do not really understand the message except that it appears a runner app has to launch the tests and that runner app is not existing. This DemoKeecoachUITests-Runner.app does not actually exist on my disk.
I cannot find anybody else mentionning the problem anywhere... I get the same error if I launch the tests in command line with xctool. I have the same problem on other computers, but I do not have the problem on other project, so it is related to the project. Any clue ?
Found it!
Was due to the Wrapper Extension build setting. It was set to app for the project and so inherited for each target. I switched it to nothing for the projet, app for the application target and xctest for the test targets.
Now the generated binaries for tests are ABCTests.xctest and not ABCTests.app anymore. It was probably like this from a long time, but I don't know for what reason...

Unit Testing Issue in Xcode

I have recently integrated XCTest into my project. It works fine when I run test cases using the play button in source editor or Using the play button in test navigator. My problem is, when I use the Test Button (The Spanner like symbol) in the ToolBar I am getting compilation errors.I already have integrated pods in my project and there is a static library created by me as well.
Note : During thorough checking I figure out all the compilation errors coming in the static library created by myself.The error count is too large so compiler shows "too much error" message
Is there any additional setup needed for including the static library into tests?
This issue arise only in case of testing I can succesfuly build and run the project
Thanks
Test Succeeded Here
Compilation Error Here
Try doing a clean build to see if xcode hasn't cached anything when you try to do a full test.
Got the solution finally, the issue is because of test target added as part of my custom library. When I try to run the test from toolbar xcode try to run all the unit test targets (My main project's test and my custom library's test case ). Library's test case can't run independently because it has some coupling with main project. Remove the test target and run test cases everything perfect.

Add Test Target to existing project in Xcode 6.3

Note: this question is related, but the answer given there does not solve the issue for me: XC Testing Framework iOS(XCode 6.1) Test session exited(80) without checking in
I have existing iOS code, and I want to start writing XCTest cases using my Xcode 6.3. I create a Test Target by clicking on the + in the Test Navigator. A test target is created for me, including a file Tests with unit tests in them.
The test starts greyed out in the Test Navigator (I cannot click cmd+T).
Question 1: How can I enable the tests?
EDIT: The answer is described in this screenshot: https://www.evernote.com/shard/s4/sh/6a5ca990-d723-46ee-bf77-2cf0ff4e70b2/1a62c472fbbeeffa595fcecd4a9fbbf7, which I found here: Adding Unit Tests to an already existing project?
In my project settings, I have the following settings for my production target (legacy):
And the following settings for my test target (auto generated):
If I run my test anyway manually by clicking on the Play button in the Test Navigator, I receive the following extensive error messages.
Warning: Error creating LLDB target at path '/Users/erwin/Library/Developer/Xcode/DerivedData/NyonOrder-bzkqdvtkegbjpuccyzmrgprbjqgm/Build/Products/Debug-iphonesimulator/OrderWriter.app'- using an empty LLDB target which can cause slow memory reads from remote devices.
IDEBundleInjection.c: Error 3585 loading bundle '/Users/erwin/Library/Developer/Xcode/DerivedData/NyonOrder-bzkqdvtkegbjpuccyzmrgprbjqgm/Build/Products/Debug-iphonesimulator/NyonOrderTests.xctest': The bundle “NyonOrderTests” couldn’t be loaded because it doesn’t contain a version for the current architecture.
DevToolsBundleInjection environment:
XCInjectDiagnostics: (null)
XCInjectBundleInto: /Users/erwin/Library/Developer/Xcode/DerivedData/NyonOrder-bzkqdvtkegbjpuccyzmrgprbjqgm/Build/Products/Debug-iphonesimulator/OrderWriter.app/OrderWriter
XCInjectBundle: /Users/erwin/Library/Developer/Xcode/DerivedData/NyonOrder-bzkqdvtkegbjpuccyzmrgprbjqgm/Build/Products/Debug-iphonesimulator/NyonOrderTests.xctest
TestBundleLocation: /Users/erwin/Library/Developer/Xcode/DerivedData/NyonOrder-bzkqdvtkegbjpuccyzmrgprbjqgm/Build/Products/Debug-iphonesimulator/NyonOrderTests.xctest
TMPDIR: /Users/erwin/Library/Developer/CoreSimulator/Devices/7094B929-04BD-459E-8E83-BDF9CBFA397A/data/Containers/Data/Application/B02B9956-754B-4663-9BC2-7191B0C2BFFE/tmp
DYLD_LIBRARY_PATH: /Users/erwin/Library/Developer/Xcode/DerivedData/NyonOrder-bzkqdvtkegbjpuccyzmrgprbjqgm/Build/Products/Debug-iphonesimulator
DYLD_INSERT_LIBRARIES: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/IDEBundleInjection.framework/IDEBundleInjection
DYLD_FRAMEWORK_PATH: /Users/erwin/Library/Developer/Xcode/DerivedData/NyonOrder-bzkqdvtkegbjpuccyzmrgprbjqgm/Build/Products/Debug-iphonesimulator
DYLD_FALLBACK_LIBRARY_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib
DYLD_FALLBACK_FRAMEWORK_PATH: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks
*** Test session exited(80) without checking in. Executable does not provide an architecture compatible with the current process. If you believe this error represents a bug, please attach the log file at /var/folders/cn/sfcysstx0zxb13qzdj35rh040000gn/T/com.apple.dt.XCTest-status/Session-2015-04-10_13:58:25-8ifyOV.log
Question 2: Which settings do I additionally have to check/change to be able to run tests?
EDIT Adding arm64 to the production target valid architecture solved this particular error. Is this dangerous to add?

iOS: Linker errors with OCUnit integration

I am adding OCUnit test case target to my existing iOS project. I have followed the tutorials from below links and done it. It created a new target for "MyAppTests" and .m, .h files. I added SenTestingKit.framework also.
http://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/UnitTesting/02-Setting_Up_Unit_Tests_in_a_Project/setting_up.html#//apple_ref/doc/uid/TP40002143-CH3-SW1
http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/
But when i click on "Product" menu "Test" option, it gives always the following linker errors.
I tried solving errors by following these links and the solution they have provided,
xcode 4 fails to initiate unit tests (with linker error) after I created a new scheme
OCUnit testing an embedded framework
but, none of the solution worked for me, its still giving linker errors as it is. Please help on resolving these errors.
Thank you.
I resolved it myself, i just removed everything related to test target and created new test target and followed the same as per below Apple link, and it worked as expected!
http://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/UnitTesting/02-Setting_Up_Unit_Tests_in_a_Project/setting_up.html#//apple_ref/doc/uid/TP40002143-CH3-SW1

Resources