UITesting just fails with no tests written without any more context - ios

I am new to UITesting, I haven't written any tests in UITesting base file. Still, it fails without any more context how to fix it? even its not showing red cross sign as it shows in unit test files.
I've created a new project and checked there, it works fine. I'm adding it in an existing project. Any settings I've to do to make it work in the schema?
Whereas Unit Tests works fine.

Fortunately, I solved this issue. Select your UI test target → build setting → remove other linker flags if set.
I am posting this, so other developers get help, in case they are receiving this error.

Related

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...

My Test Navigator copies some test cases from one test class to another

In this case my method testDidSelectLocation() should be in DBLocationsViewControllerTests. For some reason this is copied into another classes, marked with violet icon, and trying to pass a whole test. That additional tests, sometimes do not pass the tests. It is fixed only when I mark it as disabled. How to remove them?
I got this problem after removing some of the tests which I don't need.
Following steps solved my problem:
1.)Quit Xcode
2.)Open your scheme file in a text editor(Don't use Xcode UI to edit scheme, you have to manually open from your local storage, I found it under: xxxxx.xcodeproj/xcshareddata/xcschemes/xxxx-tests.xcscheme)
3.)Delete all the skipped tests under <SkippedTests>...</SkippedTests>
4.)Delete Derived data folder under Developer/Xcode
5.)Restart Xcode

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?

how to config and run objective C test cases in Xcode--XCTest

I was reading the document of XCTest(and personally i think the documentation for this part is not that enough) and I thought I should give it a try for a new project(a MAC command-line project, not and iOS project). and then I faced complaints about linking issues--the test case building failed because the conresponsding class .o(if I am not wrong) files are not found. (the error mes here was not recorded by me, sorry)
Then I wanted to delete the test project and in the end I did not even manage to remove the test project. So seriously, how to remove an exsiting project from the solution if the notion in VS applies here?
After failing at that, I removed the auto-generated test file and created my own test case file and strangely, although Xcode detects the existence of the new test case and test method, the build failed and it failed with no issues--no linking issue, no syntax or whatever issue but it just failed. Now I do not know how to move on now as I do not even get a complaint or an error.
I don't know enough about the state of your project to be certain what the problem is, but here is something to consider: If Xcode added a new build target for your tests, be sure that the .m files that contain the classes you are testing are included in the new build target. You can do this by clicking on the relevant .m file in the Project Navigator and looking at the "Target Membership" in the File Inspector pane. Make sure the box is checked next to the test target.

Resources