Search code examples
xcode10xcuitest

Test target of XCUITest seems not to be working after updating to Xcode 10


I updated to xcode 10 from Xcode 9.4 and then when trying to run my UI tests nothing seems to be working. The test app loads for a while then test failed although the build is successfully done before the tests. and the source code builds successfully as well and I can run the app on the simulator.

The error is:

Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. (Underlying error: The test runner failed to load the test bundle. Executable cannot be loaded for some other reason, such as a problem with a library it depends on or a code signature/entitlements mismatch.))


Solution

  • First, if you are using Cocoapods make sure your test target has the inherited search paths set up, something like that for instance :

    # MARK: Common pods
    abstract_target 'AppCommon' do
      pod 'Alamofire'
    
      target 'MyFrameworkA' do
        project './MyPath/MyFrameworkA/MyFrameworkA.xcodeproj'
    
        target 'MyFrameworkATests' do
          inherit! :search_paths
        end
      end
    end
    

    Next, in your Build phases of your FrameworkA, make sure that any other frameworks (B, C used in A), are set up as target dependencies AND added to the Linked Binary With Libraries.

    Finally, make sure your FrameworkATests target have your FrameworkA in Target Dependencies and is added in the Linked Binary With Libraries phase too.