Question posted in Xcode
Whether you're new to Xcode or an experienced developer, our archive has everything you need to know about this integrated development environment (IDE). From basic functionalities to advanced features, our archive covers a wide range of Xcode-related questions and answers. Browse our archive now and find solutions to your Xcode questions, and take your app development skills to the next level
Whether you're new to Xcode or an experienced developer, our archive has everything you need to know about this integrated development environment (IDE). From basic functionalities to advanced features, our archive covers a wide range of Xcode-related questions and answers. Browse our archive now and find solutions to your Xcode questions, and take your app development skills to the next level
2
Answers
If you are using Xcode 11 or above, You can use the following command to inspect the contents from the command line.
And also export the data as JSON using using
--format json
see this WWDC talk for more information
Lior is on the right track.
First build and test the app using the xcodebuild using the following command from the root of the project
This will dump all the DerivedData inside the Build directory.
This will generate the code coverage data at path Build/Logs/Test. We will see code coverage with .xccovreport and .xccovarchive extension.
Then to view code coverage reports in the default format which isn’t particularly great but as per the Apple, it’s human readable. However we can generate the report using the following command
The real power of the xccov comes when it can generate the code coverage reports in the JSON format. As per Apple’s documentation on the man page, its machine representable format. We can hook these JSON results anywhere we like or build another tool on top of this. We can generate JSON reports using the following command