Cocoapods: "Code Coverage Data Generation Failed" while running tests

Created on 20 May 2016  Â·  17Comments  Â·  Source: CocoaPods/CocoaPods

What did you do?

I upgrade our project form 0.39 to 1.0

What did you expected to happen?

I expected to be able to run our tests properly.

What happened instead?

I keep getting this error:
image

CocoaPods Environment

Stack

   CocoaPods : 1.0.0
        Ruby : ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
    RubyGems : 2.5.1
        Host : Mac OS X 10.11.5 (15F34)
       Xcode : 7.3.1 (7D1014)
         Git : git version 2.7.4 (Apple Git-66)
Ruby lib dir : /Users/berzerker/.rbenv/versions/2.3.1/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ b505e9434877b77b63b1c141d599243ef2583cdf

Installation Source

Executable Path: /Users/berzerker/.rbenv/versions/2.3.1/bin/pod

Plugins

cocoapods-deintegrate : 1.0.0
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.0.0
cocoapods-try         : 1.0.0

Podfile

inhibit_all_warnings!
platform :ios, '9.0'

target 'MyTarget' do

  use_frameworks!

  pod 'ActionKit', '1.0'
  pod 'AFNetworking', '1.3.4'
  pod 'Analytics', '3.0.7'
  pod 'AppsFlyerFramework', '4.4.1'
  pod 'ARSPopover', '2.2.1'
  pod 'AsyncImageView', '1.5.1'
  pod 'BKPasscodeView', '0.2.2'
  pod 'Crashlytics', '3.7.0'
  pod 'Fabric', '1.6.7'
  pod 'FBSDKLoginKit', '4.12.0'
  pod 'GoogleAnalytics', '3.14.0'
  pod 'GoogleConversionTracking', '3.4.0'
  pod 'GPUImage', '0.1.7'
  pod 'JazzHands', '2.0.8'
  pod 'libPhoneNumber-iOS', '0.8.12'
  pod 'ODRefreshControl', '1.2'
  pod 'Optimizely-iOS-SDK', '1.4.2'
  pod 'pop', '1.0.9'
  pod 'RSKImageCropper', '1.5.1'
  pod 'Stripe', '6.2.0'
  pod 'TTTAttributedLabel', '1.13.4'
  pod 'ZBarSDK', '1.3.1'
  pod 'ZendeskSDK', '1.6.0.1'

  target 'MolokiniLogicTests' do
    inherit! :search_paths
    pod 'OCMock', '3.3'
    # These are required for now because of our current testing setup.
    pod 'AppsFlyerFramework', '4.4.1'
    pod 'BKPasscodeView', '0.2.2'
    pod 'Crashlytics', '3.7.0'
    pod 'GoogleAnalytics', '3.14.0'
    pod 'Optimizely-iOS-SDK', '1.4.2'
    pod 'Stripe', '6.2.0'
    pod 'TTTAttributedLabel', '1.13.4'
  end

  target 'MolokiniUITests' do
    inherit! :search_paths
  end

end

post_install do |installer|
    puts("Update debug pod settings to speed up build time")
    Dir.glob(File.join("Pods", "**", "Pods*{debug,Private}.xcconfig")).each do |file|
        File.open(file, 'a') { |f| f.puts "\nDEBUG_INFORMATION_FORMAT = dwarf" }
    end
end

Project that demonstrates the issue

I can't provide the repo to our project.
But reverting back to CocoaPods 0.39 fixes the issue.

awaiting input

Most helpful comment

For some reason, it appears that CocoaPods is not adding the "[CP] Embed Pods Frameworks" build phase to the UI Tests target when generating the project workspace.

I manually added this in and the UI Tests were runnable again.

This build phase should run the following script: (Replace {YourProject} with your project name)

"${SRCROOT}/Pods/Target Support Files/Pods-{YourProject}UITests/Pods-{YourProject}UITests-frameworks.sh"

All 17 comments

Are you experiencing this when running your unit or your UI tests?

@neonichu unit tests, note that the tests aren't hosted, could this be impacting this?
image

EDIT:
I plan on fixing this in the future (to have the tests hosted and have another framework target) but would be nice to confirm that it is/not impacting this issue.

I have definitely seen using UIKit without a test host causing issues — it's curious that this depends on switching CocoaPods versions, though. I assume you were also using use_frameworks! before?

Yes, were were always using use_frameworks!

This also happened to me but only with testing on a device, not a simulator. And I can confirm, 0.39 was fine but 1.0.0 made everything go crazy.

Don't see a good way to debug this without a test project, unfortunately. Let us know if one of you figures out how to reproduce it, thanks!

Hi!
I am having the same problem. I get the same message:
I can record a ui test case, but then I cannot run it. (gif bellow)
octopodiumuitests

This happens on the this project:
https://github.com/nunogoncalves/iOS-OctoPodium

For some reason, it appears that CocoaPods is not adding the "[CP] Embed Pods Frameworks" build phase to the UI Tests target when generating the project workspace.

I manually added this in and the UI Tests were runnable again.

This build phase should run the following script: (Replace {YourProject} with your project name)

"${SRCROOT}/Pods/Target Support Files/Pods-{YourProject}UITests/Pods-{YourProject}UITests-frameworks.sh"

@dfleming The UI Tests embedding bug has been fixed in master

I'm seeing this too when running unit tests with code coverage. It only happens when running them on a device.

For me happens the same as for @skyem :-(
I use the pod version 1.1.0.rc.2
This is really sad since we love to use the code cov feature of Xcode.

Closing due to lack of activity (also I'm pretty sure this is fixed now)

It isn't fixed and still happening to us. We ran into the exact same issue during UI tests. @DanToml

@marcelvoss this is a rather old issue with CocoaPods 1.0.0 version reported. Please file a new issue using the template and hopefully a sample app that makes it easier for us to debug it and fix it.

Also getting this issue

I am getting this issue as well when running UI tests

Up until yesterday afternoon I was seeing this issue with my UI test bundle as well.

The issue went away for me when I relocated the target definition in the Podfile.

Before, I was defining my UI tests target inside the main target like so:

target 'MyApp' do
  use_frameworks!
  inhibit_all_warnings!

  app_pods

  target 'MyAppTests' do
    inherit! :search_paths
    testing_pods
  end

  target 'MyAppUITests' do
    inherit! :search_paths
    testing_pods
  end
end

I changed it to look like this:

target 'MyAppUITests' do
  use_frameworks!
  inhibit_all_warnings!
  testing_pods
end

target 'MyApp' do
  use_frameworks!
  inhibit_all_warnings!

  app_pods

  target 'MyAppTests' do
    inherit! :search_paths
    testing_pods
  end
end

Your mileage may vary.

Was this page helpful?
0 / 5 - 0 ratings