yonaskolb / yonaskolb/XcodeGen

The flag -testPlan <name> cannot be used since the scheme does not use test plans

Open
#1,252 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
8.8k
Forks
908
Avg merge
17d 14h
Merged PRs (30d)
2

Description

Good day! I have a problem setting up test plans.

I have a MyProject project and tests are attached to it. accordingly, I create a test plan(smoke.xctestplan) that includes some of these tests MyProjectUITests.

But when I enter the command:

xcodebuild -showTestPlans -scheme MyProject

Output:

The scheme "MyProject" is not configured to use test plans.

When I enter the command:

xcodebuild -workspace MyProject.xcworkspace -scheme MyProject -destination 'platform=iOS Simulator,name=iPhone 11 Pro Max' test -testPlan smoke

Output:

The flag -testPlan <name> cannot be used since the scheme does not use test plans

I'm guessing I misconfigured the file I'm project.yml

I am attaching the config file below.

Thanks, any advice would be appreciated!

name: MyProject

options:
  defaultConfig: Release
  groupSortPosition: bottom
  transitivelyLinkDependencies: false

configs:
  Debug: debug
  Release: release
  Test: debug

attributes:
  ORGANIZATIONNAME: Uma.tech

packages:
  Swinject:
    url: https://github.com/Swinject/Swinject
    minorVersion: 2.7.1
  GIDSDK:
    url: https://gitlab.zxz.su/mbushuev/gidsdk.pod.git
    minorVersion: 0.1.11
  CryptoSwift:
    url: https://github.com/krzyzanowskim/CryptoSwift.git
    minorVersion: 1.5.1

options:
  postGenCommand: pod install
targets:
  MyProject:
    scheme:
      testTargets:
        - MyProjectTests
        - MyProjectUITests
      testPlans:
        - path: smoke.xctestplan
          defaultPlan: true
    type: application
    platform: iOS
    deploymentTarget: 11.0
    name: MyProject
    sources:
      - ./MyProject
      - path: ./Localizable.stringsdict
      - path: ./MyProject/MyProject.entitlements
      - path: ./MyProject/Info.plist
      - path: ./MyProject/Resources/Assets.xcassets
        buildPhase: resources
    templates: [Shared]
    entitlements:
      path: ./MyProject/MyProject.entitlements
      properties:
        com.apple.security.application-groups: [group.one.myProject]
        com.apple.developer.associated-domains: [applinks:*.myProject.ru, applinks:www.myProject.ru, applinks:myProject.ru, applinks:*.myProject.one, applinks:www.myProject.one, applinks:myProject.one]
        keychain-access-groups: [$(AppIdentifierPrefix)ru.gpmrtv.svod]
        aps-environment: development
        com.apple.smoot.subscriptionservice: true
    settings:
      base:
        ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: YES
        ASSETCATALOG_COMPILER_APPICON_NAME: "AppIcon"
        CODE_SIGN_ENTITLEMENTS: "MyProject/MyProject.entitlements"
        CLANG_ENABLE_MODULES: YES
        CODE_SIGN_IDENTITY: "iPhone Distribution"
        CODE_SIGN_STYLE: Manual
        CURRENT_PROJECT_VERSION: 1
        DEBUG_INFORMATION_FORMAT: "dwarf-with-dsym"
        DEVELOPMENT_TEAM: 7LYWWLCN92
        FRAMEWORK_SEARCH_PATHS:
          - "$(inherited)"
          - "$(PROJECT_DIR)/UmaPlayerFramework"
        GCC_NO_COMMON_BLOCKS: NO
        GCC_WARN_INHIBIT_ALL_WARNINGS: NO
        INFOPLIST_FILE: ./MyProject/Info.plist
        LD_RUNPATH_SEARCH_PATHS:
          - "$(inherited)"
          - "@executable_path/Frameworks"
          - "@loader_path/Frameworks"
        LLVM_LTO: NO
        MARKETING_VERSION: 2.34.0
        PRODUCT_BUNDLE_IDENTIFIER: ru.gpmrtv.svod
        PROVISIONING_PROFILE_SPECIFIER: "iOS_AppStore"
        SWIFT_OBJC_BRIDGING_HEADER: "MyProject-Bridging-Header.h"
        SWIFT_VERSION: 5.0
        TARGETED_DEVICE_FAMILY: 1,2
        iOS_DEPLOYMENT_TARGET: 11.0
        GCC_PREPROCESSOR_DEFINITIONS:
          - "$(inherited)"
          - "COCOAPODS=1"
        OTHER_CODE_SIGN_FLAGS: --timestamp
        DEFINES_MODULE: YES
        ENABLE_BITCODE: NO
      configs:
        ENABLE_SWIFTLINT: NO
        Test:
          SWIFT_ACTIVE_COMPILATION_CONDITIONS: TEST
    dependencies:
      - framework: ./UmaPlayerFramework/UmaFoundation.xcframework
        embed: true
      - framework: ./UmaPlayerFramework/UmaDownloader.xcframework
        embed: true
      - framework: ./UmaPlayerFramework/UmaMedia.xcframework
        embed: true
      - framework: ./UmaPlayerFramework/UmaSentry.xcframework
        embed: true
      - package: Swinject
      - package: GIDSDK
      - package: CryptoSwift

  MyProjectTests:
    type: bundle.unit-test
    platform: iOS
    name: MyProjectTests
    sources:
      - ./MyProjectTests
    settings:
      base:
        BUNDLE_LOADER: "$(TEST_HOST)"
        TEST_HOST: "$(BUILT_PRODUCTS_DIR)/MyProject.app/MyProject"
    dependencies:
      - target: MyProject

  MyProjectUITests:
    type: com.apple.product-type.bundle.ui-testing
    platform: iOS
    name: MyProjectUITests
    deploymentTarget: 13.0
    sources:
      - ./MyProjectUITests
    dependencies:
      - target: MyProject
      
schemes:
  MyProject:
    build:
        targets:
            MyProject: all
    test:
      targets:
        - MyProjectUITests
      testPlans:
        - path: smoke.xctestplan
          defaultPlan: true

targetTemplates:
  Shared:
    preBuildScripts:
      - script: |
          if [ "$CONFIGURATION" == "Debug" ] || [ "$CONFIGURATION" == "Test" ] ; then
          echo "Skip frameworks cleaning in debug version"
          exit 0
          fi
          
          APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

          # This script loops through the frameworks embedded in the application and
          # removes unused architectures.
          find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
          do
          FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
          FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
          echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

          EXTRACTED_ARCHS=()

          for ARCH in $ARCHS
          do
          echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
          lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
          EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
          done

          echo "Merging extracted architectures: ${ARCHS}"
          lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
          rm "${EXTRACTED_ARCHS[@]}"

          echo "Replacing original executable with thinned version"
          rm "$FRAMEWORK_EXECUTABLE_PATH"
          mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

          done
        name: "Run script"
        

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with project.yml and the generated MyProject scheme, then run the reported xcodebuild -showTestPlans and test commands to compare the scheme's test-plan configuration. Trace how the schemes.MyProject.test.testPlans entry is handled and verify the generated scheme recognizes smoke.xctestplan. Done means the generated scheme lists the plan and accepts -testPlan smoke.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.