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

Cannot get unit tests stats due to missing test logs either in derived data or result bundle path #127

Open
mollyIV opened this issue Feb 23, 2021 · 7 comments

Comments

@mollyIV
Copy link
Contributor

mollyIV commented Feb 23, 2021

I'd like to gather the test coverage statistics for a given target in a project. The Xcode version that I use is 12.4. I did run tests for a project via xcodebuild command:

$ xcodebuild test -scheme Demo -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11 Pro,OS=14.4' -resultBundlePath ~/Demo/result

According to the blog post mentioned in the README file, there should be .xcactivitylog log generated at the result bundle path, however, with Xcode 12.4, it is not. There's a .xcresult file instead.

I also checked the derived data and same results.

I tried to simply parse the build activity log, but no data about unit tests has been found:

$ xclogparser parse --project Demo --reporter html

Could you please help me to figure out the way to get the unit tests coverage stats? 🙏

I will gladly update the documentation if needed 😊

@polac24
Copy link
Collaborator

polac24 commented Feb 24, 2021

Hi Daniel!
I tried Xcode 12.4 behaviour for a brand new project and .xcactivitylog files are placed in the derived data.

To customize that dir, you can append -derivedDataPath, like

xcodebuild test -scheme Demo -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11 Pro,OS=14.4' -resultBundlePath ~/Demo/result -derivedDataPath ~/Demo/DerivedData

and the loot at ~/Demo/DerivedData/{{Project}}/Logs/Build/.

If you call xcodebuild test and your DerivedData contains all products required for the test, indeed the *.xcactivitylog is in a lightweight format. To get a full build log, please try calling xcodebuild clean test... or xcodebuild clean build-for-testing ...

@mollyIV
Copy link
Contributor Author

mollyIV commented Feb 25, 2021

Hey Bartosz! Thank you for the response.

I prepared a vanilla Swift iOS app project, cleaned up the derived data and run xcodebuild clean test ..., but still no unit tests coverage information from a parse command (I tired different reporters).

Below some screenshots how the output looks like:

root-project

derived-data-logs

derived-data-build-logs

coverage

Could you please provide your steps in order to get the unit tests coverage report via xclogparser? 🙏

@polac24
Copy link
Collaborator

polac24 commented Feb 25, 2021

XCLogParser can capture building logs (compilation steps, errors, warnings etc.) but not unit tests results like code coverage. When you run tests in Xcode or xcodebuild the only generated .xcactivitylog file contains a summary of all steps in the build-for-testing phase (you have it generated in the Build dir).

@mollyIV
Copy link
Contributor Author

mollyIV commented Feb 25, 2021

XCLogParser can capture building logs (compilation steps, errors, warnings etc.) but not unit tests results like code coverage.

That's interesting. According to the README file:

XCLogParser can give a lot of insights in regards to build times for every module and file in your project, warnings, errors and unit tests results.

Apparently, I miss-understood "unit tests results" phrase then. Maybe we could avoid ambiguity and tweak the documentation to clearly point out what type of unit tests results are available? 😊

@polac24
Copy link
Collaborator

polac24 commented Feb 25, 2021

@ecamacho, do you remember what did we mean by "rests results" in a Readme file?

@OliverKoo
Copy link

bump on this - I was also under the impression xclogparser can parse unit tests results or maybe XCLogParser expect xcodebuild test generate a .xcactivitylog file at some point? and the newwer Xcode no longer does that?

@PatrikBillgren
Copy link
Collaborator

@ecamacho Do you have any knowledge about this issue? Thanks

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

4 participants