openbakery / gradle-xcodePlugin

gradle plugin for building Xcode Projects for iOS, watchOS, macOS or tvOS
Apache License 2.0
457 stars 127 forks source link

xcodetest task produces empty test-results.xml file with Xcode 11.0 #419

Closed adil-hussain-84 closed 4 years ago

adil-hussain-84 commented 4 years ago

I am using the latest stable release of the plugin (0.19.1) and I've just upgraded my Xcode installation from 10.3 to 11.0. I'm seeing that the plugin's xcodetest task is able to run the tests in my project but it's no longer able to parse the output produced by Xcode in order to produce a test-results.xml file. The file is produced but its contents are as follows:

<testsuites />

On inspection of the derivedData/Logs/Test folder I can see that the two versions of Xcode create the test output differently, as follows:

The following paragraph in the Xcode 11 release notes describes the change:

The format of result bundles changed in Xcode 11. A result bundle is an asset produced by Xcode 11 with the xcresult file extension that contains information about the build, tests, code coverage, and more. Any xcresult files produced with Xcode 10 or earlier cannot be read by Xcode 11. A result bundle can be produced by passing -resultBundlePath ./Example.xcresult to an xcodebuild invocation and the Example.xcresult can then be opened in Xcode. Xcode also creates result bundles in Derived Data. The current result bundle version number is 3, which can be specified by passing the xcodebuild flag -resultBundleVersion 3. Version 3 is the default in Xcode 11, but it is still recommended for automation to explicitly pass the flag, so that any potential future versions that become the default do not cause issues to existing tools. Result bundles can be inspected using xcresulttool. A JSON representation of the root object of the result bundle can be exported using xcrun xcresulttool get --format json --path ./Example.xcresult and any nested object, identified by its reference found in the JSON output, can be exported by adding the flag --id REF. xcresulttool also provides the description of its format using xcrun xcresulttool formatDescription. (41633595)

BastianKusserow commented 4 years ago

Hey, I am currently working on getting the new format parsed. Hope to open a PR for that in the next days.

fonkadelic commented 4 years ago

Closed by #420