Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-62471

Xcode Plugin - Unable to run Unit Tests

    Details

    • Similar Issues:

      Description

      Plugin version: 2.0.6
      Xcode version: 11.3.1
      Issue:
      I am following the exact same steps to set up unit tests via Xcode plugin but it doesn't work. Throws the error saying: 

      {{xcodebuild: error: Failed to build workspace MyWorkspace with scheme My-scheme.Reason: The scheme 'My-scheme' is not configured for Running.

      It runs perfectly while using xcodebuild test CLI command but I would like to see if it is possible via Plugin to maintain consistency. }}

      Setting up a unit test step

      Add the XCode build step and this time specify your unit test target (e.g. MyAppTests), configuration (e.g. Debug) and the SDK (e.g. Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/).
      Leave all the checkboxes unselected. The SDK needs to be supplied here as the unit tests will only be run when building under the simulator's SDK.

        Attachments

          Activity

          Hide
          chrismcx Christophe MICHAUX added a comment -

          Hello.

          +1 about this issue.

          I currently use this command line to run unit test. I'ld like to use the XCode Plugin instead.

          xcodebuild -workspace 'myproject.xcworkspace' -scheme "myprojectTests" -destination "name=iPhone 11,OS=13.3" -enableCodeCoverage YES ONLY_ACTIVE_ARCH=YES  test

           

          So i have the same issue while launching with plugin DSL method :

          xcodeBuild(
          xcodeSchema: "myprojectTests",
          xcodeName: 'latest',
          configuration: 'Debug',
          xcodeWorkspaceFile: 'myproject',
          sdk: 'iphonesimulator13.2',
          xcodebuildArguments: "test -destination \"name=iPhone 11\" -enableCodeCoverage YES",
          resultBundlePath: 'test-result',
          )

           

          In fact, by default, the "build" parameters is added in xcodebuild command instead of "test". 

          Can you confirm this is an issue ?

          I can eventually fix and create a PR to fix this issue.

          Thank you.

           

           

          Show
          chrismcx Christophe MICHAUX added a comment - Hello. +1 about this issue. I currently use this command line to run unit test. I'ld like to use the XCode Plugin instead. xcodebuild -workspace 'myproject.xcworkspace' -scheme "myprojectTests" -destination "name=iPhone 11,OS=13.3" -enableCodeCoverage YES ONLY_ACTIVE_ARCH=YES  test   So i have the same issue while launching with plugin DSL method : xcodeBuild( xcodeSchema: "myprojectTests", xcodeName: 'latest', configuration: 'Debug', xcodeWorkspaceFile: 'myproject', sdk: 'iphonesimulator13.2', xcodebuildArguments: "test -destination \"name=iPhone 11\" -enableCodeCoverage YES", resultBundlePath: 'test-result', )   In fact, by default, the "build" parameters is added in xcodebuild command instead of "test".  Can you confirm this is an issue ? I can eventually fix and create a PR to fix this issue. Thank you.    
          Hide
          urmil025 Urmil Shah added a comment -

          Yes, I believe this IS the issue. The doc mentions that you pass on the test target/scheme to the same build plugin but ideally this runs it as a build and not test. 

          Have you tried using the xcodebuildArguments to specify "-workspace 'myproject.xcworkspace' -scheme "myprojectTests" -destination "name=iPhone 11,OS=13.3" -enableCodeCoverage YES ONLY_ACTIVE_ARCH=YES  test" keeping everything else blank? 

          Show
          urmil025 Urmil Shah added a comment - Yes, I believe this IS the issue. The doc mentions that you pass on the test target/scheme to the same build plugin but ideally this runs it as a build and not test.  Have you tried using the  xcodebuildArguments  to specify " -workspace 'myproject.xcworkspace' -scheme "myprojectTests" -destination "name=iPhone 11,OS=13.3" -enableCodeCoverage YES ONLY_ACTIVE_ARCH=YES  test"  keeping everything else blank? 

            People

            • Assignee:
              Unassigned
              Reporter:
              urmil025 Urmil Shah
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: