openbakery / gradle-xcodePlugin

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

process and export attachments of tests #452

Closed BastianKusserow closed 2 years ago

BastianKusserow commented 2 years ago

This MR enables exporting XCTest attachments so they are available as CI artifacts.

Sadly I did not had the change to test if the artifacts are correctly picked up on a CI, since I could not manage to add a jar as buildscript dependency. Maybe anyone could point me to some resources on how to add jars as dependencies? After building a jar I always get the error Plugin with id 'org.openbakery.XcodePlugin' not found.

My buildscript looks like this:

buildscript {
  repositories {
    mavenCentral()
    flatDir name: 'libs', dirs: "./libs"
  }

  dependencies {
    classpath 'org.openbakery:xcode-plugin:0.21.0'
  }
}

apply plugin: 'org.openbakery.XcodePlugin'
renep commented 2 years ago

I don't know what why you want to add a jar dependency to the build script. I have this done a long time ago have not found a project now where I'm using it. As far as I have understand your change is that you have replaced the manual result parsing of the xcode output when running test with the xcresult tool that xcode provides. I see that in this pull request there is a conflict and I'm wondering if it is in a state that I can try it on the develop version. If so than I can run my iOS projects with the version on my CI and see what happens.

BastianKusserow commented 2 years ago

Hey Rene, thanks for the quick reply! Since I do not have physical access to the runners where the builds for our project are executed (and as of now, the runner just fetches the gxp from your artifactory) I cannot really test that implementation in our project and check if the test artefacts are displayed correctly in the CI. Maybe there are other ways to build and test a particular version of the gxp (e.g. a version from a particular branch), but I am not aware of that.

I've fixed the conflicts so testing the implementation should work now.

Maybe also some words on why this feature would be helpful: In our case we are executing snapshot tests on the CI and if one of those tests is failing, the test produces an attachment with some images of the snapshot test. In the current version of the gxp, the attachments aren't exported, so it's really difficult to see why a test is failing on the CI. This MR extends the current parsing to also export (or rather store) those attachments.