Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get coverage data from XCode UI Test schemes #163

Closed
K76154 opened this issue Mar 5, 2016 · 8 comments
Closed

Unable to get coverage data from XCode UI Test schemes #163

K76154 opened this issue Mar 5, 2016 · 8 comments

Comments

@K76154
Copy link

K76154 commented Mar 5, 2016

I ran slather against XCode UI Test schemes, and it told me "No product binary found". I then set --binary-file to either the target app's product binary or the UI Test's xctest binary. Both ended up giving me a cobertura.xml with 0% coverage. It appears that the code now is bound to Unit Test only and can't process UI Tests.

@ksuther
Copy link
Contributor

ksuther commented Mar 29, 2016

You might try this with Xcode 7.3 and the latest master version of slather. Xcode 7.2 didn't write coverage for UI Tests, at least for Mac projects.

@neonichu
Copy link
Member

neonichu commented Apr 6, 2016

Duplicate of #151

@neonichu neonichu closed this as completed Apr 6, 2016
@gelemias
Copy link

Hi, when i run the tests in command line setting my own path for derived data I don't get coverage for UI Automated tests using latest Xcode and sdk.

Am I missing something? it works when running tests in Xcode and running slather afterwards without setting build_directory,

@ksuther
Copy link
Contributor

ksuther commented Apr 13, 2016

What are your slather arguments? Are you specifying your derived data directory?

@gelemias
Copy link

in my .slather.yml I have set output_directory, should I specify derived data path differently?

this is how I trigger tests and slather afterwards.

set -o pipefail; xcodebuild -workspace "$(APP_WORKSPACE_NAME)" -verbose -scheme "$(APP_TEST_SCHEME_NAME)" -destination "$(APP_TEST_TARGET)" -configuration Debug -derivedDataPath "$(APP_TEST_OUTPUT_PATH)" test | xcpretty -c -t -r junit

slather coverage --teamcity -s

.slather.yml

workspace: app.xcworkspace
xcodeproj: app.xcodeproj
scheme: app
source_directory: app
output_directory: build/reports/coverage
build_directory: build/Test
ignore:

@ksuther
Copy link
Contributor

ksuther commented Apr 14, 2016

build_directory should be the same as your derivedDataPath. If you run slather with --verbose you can also see the paths it is checking.

@gelemias
Copy link

Thank you!

It seems to be an issue with running tests through the command line because the Coverage.profdata generated using xcodebuild is different than the one that Xcode generates.

@thelvis4
Copy link

@gelemias you are right! See fastlane-community/xcov#22 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants