Test object X detected an error (early unexpected exit, operation never completed by self-tuning).

I started working with OCMock to write test cases for an existing project, which I integrated into my project workspace. After completing all the steps mentioned in this link

When I first ran my test case, it gave me this error. I searched it and tried to execute some of the solutions such as “create a new target”, “restart Xcode”, but that did not help me. Any idea?

+71
ios xcode7 ocmock
Jan 25 '16 at 10:23
source share
24 answers

I have my notes and demos for Cocoapods and Carthage here https://github.com/onmyway133/TestTarget

  • Ensure that all frameworks are associated with test targets.
  • Configure Runpath Search Paths to point to $(FRAMEWORK_SEARCH_PATHS)

Additional Information

+112
Mar 31 '16 at 20:43
source share
— -

I use carthage and the problem for me was finding dependencies for a test target. Fix:

Add $(PROJECT_DIR)/Carthage/Build/iOS to Runpath Search Paths

You can find the link here: Question of Carthage

+17
Jun 10 '16 at 11:56 on
source share

There may be another solution if you use CocoaPods and the goal of the user interface test is built into the target of the application, which, unfortunately, takes place in the default template ( pod init ).

Try moving the UI test target from the application target as follows:

from:

 platform :ios, '11.0' use_frameworks! target 'MyApp' do # Pods for MyApp target 'MyAppUITests' do inherit! :search_paths # Pods for testing end end 

so that:

 platform :ios, '11.0' use_frameworks! # Pods shared between MyApp and MyAppUITests target 'MyApp' do # Pods for MyApp only end target 'MyAppUITests' do # Pods for testing end 

The loan goes to SpacyRicochet in this release branch: https://github.com/CocoaPods/CocoaPods/issues/4752#issuecomment-305101269

+9
Jun 28 '18 at 7:38
source share

In my case, there was nothing wrong with the linked files. The simulator seems to be stuck in a message about the launch of the application, for example: "The name of the application will send you notifications." Click OK and next time my XCTests work fine.

+5
Mar 25 '16 at 9:20
source share

My solution was to add the “Copy file” phase to my test target. There I set the assignment to Frameworks and added my framework with a + sign.

+4
12 Oct '16 at 11:31
source share

Just to share your experience about this error:

I am using fastlane + cocoapods.

I have a workspace with two dynamic frames:

  • A.framework
  • B.framework

Dependencies:

  • A depends on AFNetworking using cocoapods
  • B depends on A

Dependency is defined in the subfile.

The error was caused by running tests B.

In my case, the problem was due to a missing dependency on AFNetworking for the B.framework target.

Adding a pod dependency to AFNetworking in B.framework in a Podfile, everything was allowed.

Thus, even if target B was successfully compiled, AFNetworking was not integrated into test application B, and the simulator could not start application B test, increasing this "very significant" (*) error.

(*) thanks Apple for this!

+4
Jan 19 '17 at 15:20
source share

In my case, Build Active Architecture Only only YES was installed.

For the project and purposes: Build settings → Architectures → Create an active architecture Only should be NO, not YES

+2
Jul 27 '16 at 17:55
source share

My case was special. I used 2 files as test classes. one worked fine and the other had this error.
Both links to the same foundation.

Decision

CLEAR DERIVATIVE DATA

Window => Projects => Delete (in your project)

Good luck and happy testing!

+2
Aug 30 '16 at 21:54
source share

Wow, I spent a lot of time on this, in my test suite "Host Application" was added for my application. There were no other test kits.

I expect this solution may not be the right solution for every situation, but my tests were mainly for testing the dynamic library, and I really didn't need to run the host application. I got the above error by disabling it, letting me run the tests without getting this error, and the breakpoints worked. I ran MacOS, but it is probably similar to other environments. I expect this solution may not be the right solution for every situation, but my tests were mainly for testing the dynamic library, and I really didn't need to run the host application.

In the test suite Go to the General → Testing → Set the "Host application" to "No".

+2
Jan 29 '17 at 2:02 on
source share

In my case, I did not add a Run Script phase for the Quick and Nimble libraries that I integrated using Carthage.

+2
Jul 14 '17 at 4:56 on
source share

I had the same problem and I already tried everything suggested here, but to no avail.

Running tests on another simulator solved the problem for me. After that, the original simulator also no longer caused crashes.

+2
Aug 19 '18 at 17:22
source share
 I tried many different options but none helped me except below and wasted lot of time, posting this so that really help and save time on this: Follow all of the instructions for Full Manual Configuration https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md#full-manual-configuration Tips When you come to the part where you are executing xcodebuild, if the build fails, and the log mentions "RoutingHTTPServer" or "YYCache", add these two frameworks on the Build Phases tab of the WebDriverAgentRunner target Open the WebDriverAgent.xcodeproj Select 'Targets' -> 'WebDriverAgentRunner' Open 'Build Phases' -> 'Copy frameworks' Click '+' -> add RoutingHTTPServer Click '+' -> add YYCache https://github.com/facebook/WebDriverAgent/issues/902#issuecomment-382344697 https://github.com/facebook/WebDriverAgent/issues/902#issuecomment-383362376 The build/test may also fail due to the WebDriverAgentRunner app/developer being untrusted on the device. Please trust the app and try again. While trying to access the WebDriverAgent server status, if it tries to connect on port 0, hardcode port 8100 in appium-xcuitest-driver/WebDriverAgent/WebDriverAgentLib/Routing/FBWebServer.m Original line: server.port = (UInt16)port; New line: server.port = 8100; https://github.com/facebook/WebDriverAgent/issues/661#issuecomment-338900334 
+1
Jun 12 '18 at 2:56
source share

During the creation of the Cocoa Touch Framework, each attempt to start testing ended with the same error message as the OP.

I fixed this by changing the configuration of the TEST assembly from Debug to Release.

Step 1

enter image description here

Step 2

enter image description here

Step 3

enter image description here

Note. Runpath Search Paths advanced settings Runpath Search Paths .

I use Cocoapods in version 1.6.1 and Xcode 10.1

+1
Mar 26 '19 at 15:50
source share

I would like to share my answer, hoping that this can save time.

For me, the .m file was not properly linked under "Build Phases" → "Compile Sources"

0
Jan 26 '16 at 8:25
source share

In my case, I declared the property as readonly in the header file:

 // In .h file @property (nonatomic, readonly) NSUInteger count; 

but I forgot to add this declaration in .m so that the setter is generated:

 // In .m file @property (nonatomic, assign) NSUInteger count; 

A stupid mistake, not quite sure why it appeared in this error, but adding that the line to .m fixed the problem.

0
Mar 29 '16 at 18:15
source share

In my case, my build settings -> Architects set only for armv7, and I changed the same with my Host Application for ARCHS_STANDARD

0
Jun 30 '16 at 18:02
source share

For me, I had to “trust” the developer in “Device Management” under “Settings → General” on my device. (Settings → General → Device Management → DeveloperID → “Trust the Application”) . When I started the application via side loading using my apple id.

0
Nov 18 '17 at 17:59
source share

In my case, I had to remove $(inherited) from other linker flags for my purpose of testing the user interface. I installed static libraries via cocoapods.

0
Mar 19 '18 at 21:14
source share

for me the problem was the pod file
I made a new target but forgot to add the target to the pod file

 target 'mobilesdkIntegrationTests' do // write here any predefined pods if any, like testing_pods end 

just add the target to the pod file fixed the problem

0
Aug 27 '18 at 6:52
source share

There are some automatically added project settings that come with Xcode 10, and they come from time to time, and not all the time. After downloading Xcode 10, restart your computer. Here is what fixed it for me. None of these answers fixed this for me. Hope this helps. I would like to give a better answer.

0
Sep 19 '18 at 23:36
source share

Switching from Xcode 9.4.1 to Xcode 10.1 solved the problem in my case.

0
Jan 14 '19 at 10:26
source share

In my case, I had a completely clean project with empty tests by default. If I added any module, I got this error. The solution was that at least one file in Test target should import Foundation

 import XCTest import Foundation @testable import CVZebra class CVZebraTests: XCTestCase { override func setUp() { // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. } func testExample() { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct results. } func testPerformanceExample() { // This is an example of a performance test case. self.measure { // Put the code you want to measure the time of here. } } } 
0
Jan 23 '19 at 14:50
source share

If anyone else is having this problem, this answer helped me. Set Always Insert Swift Standard Libraries to No in the project settings. I did this for the purpose of testing the user interface.

0
Apr 13 '19 at 18:00
source share

In my case, there was a problem with my application in the simulator. Before the problem arose, I handled the db migration (region) that failed and destroyed my database. After I uninstalled the application on the simulator, everything worked fine for me.

0
Apr 15 '19 at 6:32
source share



All Articles