Fastlane-plugin-test_center: multi_scan does not work with :skip_build like scan does, and fails

Created on 2 Apr 2018  ·  24Comments  ·  Source: lyndsey-ferguson/fastlane-plugin-test_center

New Issue Checklist

  • [x] Updated fastlane-plugin-test_center to the latest version
  • [x] I read the README.md
  • [x] I reviewed the example Fastfile

Issue Description


When running the multi_scan lane, it fails with an error saying cannot find xctestrun file although I am not using xctestrun option in my lane. Below is how my lane looks:

multi_scan(
workspace: File.absolute_path('../Toolkit.xcworkspace'),
device: "iPhone 8",
scheme: 'ToolkitUITests',
output_directory: "reports/ui-tests",
include_simulator_logs: false,
skip_build: true,
try_count: 3,
fail_build: true,
code_coverage: true,
)
The error I am seeing is:

+----------------------+----------------------+
| Summary for multi_scan (test_center v3.1.3) |
+----------------------+----------------------+
| try_count | 3 |
| fail_build | true |
+----------------------+----------------------+

INFO [2018-04-02 17:38:12.76]: $ xcodebuild -showBuildSettings -workspace /Users/sanjaneya/Documents/toolkit-ios/Toolkit.xcworkspace -scheme Toolkit
WARN [2018-04-02 17:38:15.79]: Command timed out after 3 seconds on try 1 of 4, trying again with a 6 second timeout...
WARN [2018-04-02 17:38:21.81]: Command timed out after 6 seconds on try 2 of 4, trying again with a 12 second timeout...
WARN [2018-04-02 17:38:29.02]: Lane Context:
INFO [2018-04-02 17:38:29.02]: {:DEFAULT_PLATFORM=>:ios, :PLATFORM_NAME=>:ios, :LANE_NAME=>"ios toolkit_ui_tests"}
ERROR [2018-04-02 17:38:29.02]: Error: cannot find xctestrun file ''
INFO [2018-04-02 17:38:29.02]: Successfully generated documentation at path '/Users/sanjaneya/Documents/toolkit-ios/fastlane/README.md'

+------+-------------------------------------------+-------------+
| fastlane summary |
+------+-------------------------------------------+-------------+
| Step | Action | Time (in s) |
+------+-------------------------------------------+-------------+
| 1 | Verifying fastlane version | 0 |
| 2 | default_platform | 0 |
| 3 | clear_derived_data | 9 |
| 4 | mkdir -p ../reports/uitest-coverage/ | 0 |
| 5 | mkdir -p ../reports/uitest-xcov-coverage/ | 0 |
| 6 | cocoapods | 23 |
| 💥 | multi_scan | 16 |
+------+-------------------------------------------+-------------+

DEBUG [2018-04-02 17:38:29.04]: All plugins are up to date
ERROR [2018-04-02 17:38:29.04]: fastlane finished with errors
DEBUG [2018-04-02 17:38:29.04]: All plugins are up to date

2.88.0 Improvements

  • [action] Fix crashlytics to not autoload gsp_path if api_token is set (#12176) via Josh Holtz
  • Improve error message when specified scheme is not found (#12182) via Cédric Luthi
  • [action] Support checking remote git tags existence (#11675) via Takeru Chuganji
  • Use Android environment to find adb (don't just rely on it being in PATH) (#12168) via Adam Cohen-Rose
  • [snapshot] Make sure matched window has a non-empty frame (#12174) via François Pradel
  • [swift] Fixes string return value and shows all lanes (even without description) (#12171) via Josh Holtz
  • [scan] Default skip_build to true in Scanfile template (#12162) via Aaron Brager

2.87.0 Lots of action fixes and xcodeproj gem update

  • [supply] Added internal track (#12128) via Josh Holtz
  • [Action] get_latest_version handles $(SRCROOT) and tries to get target that isn't test (#12138) via Josh Holtz
  • [Action] app_store_build_number converts return to int if possible (#12148) via Josh Holtz
  • Workspace contained schemes now get loaded (#12147) via Lou Franco
  • Ignore *.xcodeproj & *.xcworkspace in gem paths for detecting iOS projects (#12142) via Hiroyuki Morita
  • [Action] Add use_bundle_exec option to pod_push action (#11947) via Nicolas Braun
  • [match] Write Match encrypted files in binary mode to avoid UndefinedConversion error (#12112) via Michael Smith
  • [Action] Fix a bug that upload_symbols_to_crashlytics fails if path has a space (#12098) via Takeru Chuganji

2.86.2 Fixes get_version_number to auto-select target when there is only one

  • Fixes get_version_number to auto-select target when there is only one (#12121) via Josh Holtz

To see all new releases, open https://github.com/fastlane/fastlane/releases

Please update using bundle update fastlane
bundler: failed to load command: fastlane (/usr/local/bin/fastlane)
FastlaneCore::Interface::FastlaneError: [!] Error: cannot find xctestrun file ''
/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane_core/lib/fastlane_core/ui/interface.rb:133:in user_error!' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane_core/lib/fastlane_core/ui/ui.rb:17:inmethod_missing'
/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-plugin-test_center-3.1.3/lib/fastlane/plugin/test_center/helper/test_collector.rb:14:in initialize' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-plugin-test_center-3.1.3/lib/fastlane/plugin/test_center/helper/correcting_scan_helper.rb:32:innew'
/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-plugin-test_center-3.1.3/lib/fastlane/plugin/test_center/helper/correcting_scan_helper.rb:32:in initialize' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-plugin-test_center-3.1.3/lib/fastlane/plugin/test_center/actions/multi_scan.rb:22:innew'
/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-plugin-test_center-3.1.3/lib/fastlane/plugin/test_center/actions/multi_scan.rb:22:in run' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/runner.rb:257:inblock (2 levels) in execute_action'
/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/actions/actions_helper.rb:50:in execute_action' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/runner.rb:236:inblock in execute_action'
/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/runner.rb:231:in chdir' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/runner.rb:231:inexecute_action'
/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/runner.rb:157:in trigger_action_by_name' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/fast_file.rb:148:inmethod_missing'
Fastfile:104:in block (2 levels) in parsing_binding' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/lane.rb:33:incall'
/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/runner.rb:49:in block in execute' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/runner.rb:45:inchdir'
/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/runner.rb:45:in execute' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/lane_manager.rb:57:incruise_lane'
/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/command_line_handler.rb:36:in handle' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/commands_generator.rb:108:inblock (2 levels) in run'
/usr/local/lib/ruby/gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in call' /usr/local/lib/ruby/gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:inrun'
/usr/local/lib/ruby/gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in run_active_command' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:75:inrun!'
/usr/local/lib/ruby/gems/2.3.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in run!' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/commands_generator.rb:333:inrun'
/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/commands_generator.rb:42:in start' /usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/fastlane/lib/fastlane/cli_tools_distributor.rb:107:intake_off'
/usr/local/lib/ruby/gems/2.3.0/gems/fastlane-2.86.0/bin/fastlane:20:in <top (required)>' /usr/local/bin/fastlane:22:inload'
/usr/local/bin/fastlane:22:in `

An example of how the test_center action is being called.


I am calling the UI tests lane as: bundle exec fastlane toolkit_ui_tests --verbose

Complete output when running fastlane, including the stack trace and command used


[INSERT OUTPUT HERE]

Environment


🚫 fastlane environment 🚫

Stack

| Key | Value |
| --------------------------- | ------------------------------------------- |
| OS | 10.12.6 |
| Ruby | 2.3.3 |
| Bundler? | false |
| Git | git version 2.14.3 (Apple Git-98) |
| Installation Source | /usr/local/bin/fastlane |
| Host | Mac OS X 10.12.6 (16G1212) |
| Ruby Lib Dir | /usr/local/Cellar/ruby/2.3.3/lib |
| OpenSSL Version | OpenSSL 1.0.2j 26 Sep 2016 |
| Is contained | false |
| Is homebrew | false |
| Is installed via Fabric.app | false |
| Xcode Path | /Applications/Xcode.app/Contents/Developer/ |
| Xcode Version | 9.2 |

System Locale

| Variable | Value | |
| -------- | ----------- | - |
| LANG | en_US.UTF-8 | ✅ |
| LC_ALL | | |
| LANGUAGE | | |

fastlane files:

./fastlane/Fastfile

# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/fastlane/docs
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md
# can also be listed using the `fastlane actions` command

# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`

# If you want to automatically update fastlane if a new version is available:
# update_fastlane

# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "2.30.0"

default_platform :ios

platform :ios do
  before_all do
    # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..."
    # this folder contains the Unit Test Reports from each build.
    system "rm -rf ../test_reports/"
  end

  after_all do
  end

  # version_string returns the verion string for the build.
  # Ex:v1.0.1(15) v1.0.1 is the version number and
  # (15) is the build number
  def version_string(version_number, build_number)
    "#{version_number} (#{build_number})"
  end

  # change_log_since_last_tag retuns the list of changes commited to git since
  # the last tag
  def change_log_since_last_tag
    # http://git-scm.com/docs/pretty-formats
    # <short hash> <commit title>
    return changelog_from_git_commits(
        tag_match_pattern: 'gm/*',
        pretty: '* (%h) [%aN] %s', # added formatting for release notes from: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Jenkins.md
      #  merge_commit_filtering: 'exclude_merges'.
      )[0..500]
  end

  lane :test do
    change_log_since_last_tag

#    version_number = get_version_number
#    build_number = get_build_number
#    ipa_filename = "ConstantContact-#{version_number}-#{build_number}"
#    upload_symbols_to_crashlytics(
#      api_token: "----",
#      dsym_path: "archives/#{ipa_filename}.app.dSYM.zip",
#      binary_path: "./Pods/Fabric/upload-symbols"
#    )

  end

  desc "Runs all the TK Unit Tests as part of PR build validation"
  lane :toolkit_unit_tests do
    ENV['FASTLANE_XCODE_LIST_TIMEOUT'] = '120'
    clear_derived_data
    cocoapods(repo_update: false, silent: true) # CP repo update moved to a Jenkins task that runs once a day
    sh('mkdir -p ../reports/lint/')
    sh('mkdir -p ../reports/coverage/')
    swiftlint(
      executable: "./Pods/SwiftLint/swiftlint",
      output_file: "reports/lint/swiftlint.xml",
      reporter: "checkstyle"
    )
    scan(
      scheme: "Toolkit",
      device: "iPhone 6",
      buildlog_path: "reports/logs",
      include_simulator_logs: false,
      output_directory: "reports/unit-tests",
      output_types: "junit",
      fail_build: true,
      code_coverage: true,
      skip_build: true, # needed otherwise scan builds Toolkit twice
      clean: true
    )
    slather(
      scheme: "Toolkit",
      proj: "Toolkit.xcodeproj",
      workspace: "Toolkit.xcworkspace",
      output_directory: "reports/coverage",
      binary_basename: "Toolkit.Dev",
      source_files: "EMM/ToolkitSwift/**/*.swift",
      cobertura_xml: true,
      jenkins: true
    )
  end

  desc "Runs all the TK UI Tests"
  lane :toolkit_ui_tests do
    ENV['FASTLANE_XCODE_LIST_TIMEOUT'] = '120'
    clear_derived_data
    sh('mkdir -p ../reports/uitest-coverage/')
    sh('mkdir -p ../reports/uitest-xcov-coverage/')
    cocoapods(repo_update: false, silent: true) # CP repo update moved to a Jenkins task that runs once a day
    multi_scan(
      workspace: File.absolute_path('../Toolkit.xcworkspace'),
      device: "iPhone 8",
      scheme: 'ToolkitUITests',
      output_directory: "reports/ui-tests",
      include_simulator_logs: false,
      skip_build: true,
      try_count: 3,
      fail_build: true,
      code_coverage: true,
    )
  #  scan(
  #    scheme: "ToolkitUITests",
  #    device: "iPhone 8",
  #    output_directory: "reports/ui-tests",
  #    output_types: "html",
  #    fail_build: true,
  #    code_coverage: true,
  #    skip_build: true, # needed otherwise scan builds Toolkit twice
  #    clean: true
  #  )
    slather(
      scheme: "ToolkitUITests",
      proj: "Toolkit.xcodeproj",
      workspace: "Toolkit.xcworkspace",
      output_directory: "reports/uitest-coverage",
      binary_basename: "Toolkit.Dev",
      source_files: "EMM/ToolkitSwift/**/*.swift",
      cobertura_xml: true,
      jenkins: false
    )
    xcov(
      workspace: "Toolkit.xcworkspace",
      scheme: "ToolkitUITests",
      output_directory: "reports/uitest-xcov-coverage/",
      html_report: true,
      configuration: 'debug'
    )
  end

  # Pre-build lane runs before the Integration Bot kicks off. All the actions
  # defined in the lane are run before Integration Bot.
  desc "Pre-build step for Xcode Server Beta build"
  lane :xcs_before_beta do |options|
    clear_derived_data
    cocoapods(repo_update: true)

    # install the provisioning profiles on the server
    sh "echo '' | sudo -s cp ../ProvisioningProfiles/* /Library/Developer/XcodeServer/ProvisioningProfiles/"

    git_pull(only_tags: true)
    build_number = ENV["XCS_INTEGRATION_NUMBER"]
    if build_number != nil then
      increment_build_number(build_number: build_number)
    end
  end

  # Post-build lane runs post Integration Bot. This lane collects the change log,
  # extracts the ipa file from the archive and submits it to Crashlytics Beta
  # for distribution. And upon successful completion of the lane and finally
  # posts the message to Hipchat.
  desc "Post-build step for Xcode Server Beta build"
  lane :xcs_after_beta do |options|
    # Export the .ipa from the archive
    gym(
      scheme: 'XCSBeta',
      skip_build_archive: true,
      archive_path: "#{ENV['XCS_ARCHIVE']}",
      output_directory: "#{ENV['CRASHLYTICS_IPA_PATH']}",
      output_name: "#{ENV['IPA_NAME']}",
      export_team_id: 'XXXXXXXX',
      export_method: "enterprise"
      # use_legacy_build_api: true (disabled since Xcode 8.3 has deprecated this api)
    )
    # gym --scheme XCSBeta --skip_build_archive -b /Users/ggrell/Library/Developer/Xcode/Archives/2016-09-07/Constant\ Contact\ 2016-09-07\ 16.13.30.xcarchive -g 8748L27X7W --use_legacy_build_api

    build_number = ENV["XCS_INTEGRATION_NUMBER"] || "1337"
    version_number = options[:version_number] || get_version_number
    complete_version_number = version_string(version_number, build_number)

    change_log = change_log_since_last_tag

    crashlytics(
      crashlytics_path: "./Pods/Crashlytics/",
      api_token: "---",
      build_secret: "---",
      groups: "mobile-team,ios-test-devices",
      ipa_path: "#{ENV['CRASHLYTICS_IPA_PATH']}/#{ENV['IPA_NAME']}",
      notes: change_log,
      debug: true
    )

    #     commit_version_bump(
    #         message: "Build # bump to #{build_number}",
    #         xcodeproj: "ListBuilder.xcodeproj"
    #     )

    #   add_git_tag(tag: "LB-#{version_number}-BETA-#{build_number}")
    #    push_git_tags

    hipchat(
      api_token: "---",
      version: "1",
      message: "New build of Toolkit Beta v#{complete_version_number}",
      channel: "Mobile iOS"
    )
    # sh "your_script.sh"
    # You can also use other beta testing services here (run `fastlane actions`)
  end

  # Creates a Beta build. Uses Jenkins BUILD_NUMBER env var.
  desc "Creates a beta build"
  lane :beta do |options|
    xcversion(version: "~> 9.0")
    ensure_git_status_clean
    version_number = options[:version_number] || get_version_number(xcodeproj: "Toolkit.xcodeproj",target: "Toolkit")
    build_number = ENV["BUILD_NUMBER"] || "1337"
    increment_build_number(build_number: build_number)
    UI.message("Building beta #{version_number} (#{build_number})")
    cocoapods(repo_update: false, silent: true) # CP repo update moved to a Jenkins task that runs once a day
    sh "echo '' | plutil -remove CFBundleExecutable ../Pods/AviarySDK/AviarySDK-4.4.5/AviarySDK/AviarySDKResources.bundle/AviarySDKContentResources.bundle/Info.plist ; true"
    sh "echo '' | plutil -remove CFBundleExecutable ../Pods/AviarySDK/AviarySDK-4.4.5/AviarySDK/AviarySDKResources.bundle/Info.plist ; true"
    # install the provisioning profiles on the server
    # sh "echo '' | sudo -s cp ../ProvisioningProfiles/* /Library/Developer/XcodeServer/ProvisioningProfiles/"
    ipa_filename = "Toolkit.Beta-#{version_number}-#{build_number}"
    gym(
      scheme: "XCSBeta",
      configuration: "Beta",
      export_team_id: 'XXXXXXXX',
      export_method: 'enterprise',
      output_name: ipa_filename,
      output_directory: "archives",
      include_bitcode: false,
      silent: true,
      export_options: {
           provisioningProfiles: {
             "com.constantcontact.toolkit.beta" => "Toolkit Beta"
           }
         }
    )

    change_log = change_log_since_last_tag
    crashlytics(
      crashlytics_path: "./Pods/Crashlytics",
      api_token: "----",
      build_secret: "---",
      groups: "mobile-team,ios-test-devices",
      ipa_path: "./archives/#{ipa_filename}.ipa",
      notes: change_log,
      debug: true
    )

#    complete_version_number = version_string(version_number, build_number)
#    hipchat(
#      api_token: "---",
#      version: "1",
#      message: "New build of Toolkit Beta v#{complete_version_number}",
#      channel: "Mobile iOS"
#    )
  end

  # Creates a release build, bumps the version number by one
  # (bump:false to disable), uploads to testflight
  # (upload:false to disable), pushes changed files and tags to remote
  # (push:false to disable)
  desc "Creates a release build, bumps the build number by one (bump:false to disable), uploads to testflight (upload:false to disable), pushes changed files and tags to remote (push:false to disable)"
  lane :release do |options|
    if options[:bump].nil? then
      options[:bump] = true
    end
    if options[:upload].nil? then
      options[:upload] = true
    end
    if options[:push].nil? then
      options[:push] = true
    end

    xcversion(version: "9.0")
    ensure_git_status_clean
    version_number = get_version_number
    if options[:bump] then
      build_number = increment_build_number
    else
      build_number = get_build_number
    end
    git_tag = "gm/TK-#{version_number}-#{build_number}"
    if git_tag_exists(tag: git_tag) then
      UI.user_error!("git tag already exists: #{git_tag}. Either update the version number (#{version_number}) or delete the existing tag if version hasn't been published to TestFlight or App store.")
    end
    UI.message("Building release #{version_number} (#{build_number})")
    cocoapods
    sh "echo '' | plutil -remove CFBundleExecutable ../Pods/AviarySDK/AviarySDK-4.4.5/AviarySDK/AviarySDKResources.bundle/AviarySDKContentResources.bundle/Info.plist ; true"
    sh "echo '' | plutil -remove CFBundleExecutable ../Pods/AviarySDK/AviarySDK-4.4.5/AviarySDK/AviarySDKResources.bundle/Info.plist ; true"
    ipa_filename = "ConstantContact-#{version_number}-#{build_number}"
    gym(
      scheme: "Toolkit",
      configuration: "Release",
      export_team_id: 'XXXXXXXX',
      export_method: 'app-store',
      output_name: ipa_filename,
      output_directory: "archives",
      include_bitcode: false
    )
    if options[:bump] then
      commit_version_bump(
        xcodeproj: "Toolkit.xcodeproj",
        message: "Commit for #{version_number} (#{build_number})",
        force: true
      )
    end
    add_git_tag(
      tag: git_tag,
      message: "fastlane release build #{version_number} (#{build_number})"
    )
    if options[:push] then
      push_to_git_remote
    end
    if options[:upload] then
      # Upload dSYM to Crashlytics so that we get desymbolification for all release versions
      upload_symbols_to_crashlytics(
        api_token: "---",
        dsym_path: "archives/#{ipa_filename}.app.dSYM.zip",
        binary_path: "./Pods/Fabric/upload-symbols"
      )
      testflight(
        skip_submission: true,
        skip_waiting_for_build_processing: true
      )
    end
  end

  desc "Runs watchbuild to get notifications when a new Testflight upload is ready"
  lane :watch_release do
    sh "watchbuild -a com.constantcontact.toolkit"
  end

  desc "Downloads all the latest provisioning profiles to local directory, and updates xcodeproj to point to them"
  lane :install_profiles do
    ENV['SIGH_OUTPUT_PATH'] = './ProvisioningProfiles'
    ENV['FL_PROJECT_PROVISIONING_PROJECT_PATH'] = 'Toolkit.xcodeproj'
    ENV['FL_PROJECT_PROVISIONING_PROFILE_TARGET_FILTER'] = '^Toolkit$'
    ENV['SIGH_SKIP_CERTIFICATE_VERIFICATION'] = 'true' # https://github.com/KrauseFx/sigh/issues/141

    # create a folder for our provisioning profiles if not exists
    sh "cd .. && mkdir -p ProvisioningProfiles"

    # generate development profile
    profile_name = 'Toolkit Dev'
    profile_file = "#{profile_name}.mobileprovision"
    profile_path = "./ProvisioningProfiles/#{profile_file}"
    udid_dev = get_provisioning_profile(
      team_id: 'XXXXXXXX',
      app_identifier: 'com.constantcontact.toolkit.dev',
      provisioning_name: profile_name,
      filename: profile_file,
      development: true
    )

    # generate beta profile
    profile_name = 'Toolkit Beta'
    profile_file = "#{profile_name}.mobileprovision"
    profile_path = "./ProvisioningProfiles/#{profile_file}"
    udid_dev = get_provisioning_profile(
      team_id: 'XXXXXXXX',
      app_identifier: 'com.constantcontact.toolkit.beta',
      provisioning_name: profile_name,
      filename: profile_file
    )

    # generate appstore profile
    profile_name = 'Toolkit App Store'
    profile_file = "#{profile_name}.mobileprovision"
    profile_path = "./ProvisioningProfiles/#{profile_file}"
    udid_appstore = get_provisioning_profile(
      team_id: 'XXXXX',
      app_identifier: 'com.constantcontact.toolkit',
      provisioning_name: profile_name,
      filename: profile_file
    )

  end

  error do |lane, exception|
    if (['xcs_before_beta', 'xcs_after_beta'].include? lane) then
      hipchat(
        api_token: "---",
        version: "1",
        success: false,
        message: "Toolkit Beta build failed (lane: #{lane}).\n#{exception}",
        channel: "Mobile iOS"
      )
    end
  end
end


# More information about multiple platforms in fastlane: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md

# fastlane reports which actions are used
# No personal data is recorded. Learn more at https://github.com/fastlane/enhancer

./fastlane/Appfile

# you can even provide different app identifiers, Apple IDs and team names per lane:
# More information: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Appfile.md

fastlane gems

| Gem | Version | Update-Status |
| -------- | ------- | ------------------ |
| fastlane | 2.86.2 | 🚫 Update available |

Loaded fastlane plugins:

| Plugin | Version | Update-Status |
| --------------------------- | ------- | ------------- |
| fastlane-plugin-test_center | 3.1.3 | ✅ Up-To-Date |

Loaded gems

| Gem | Version |
| --------------------------- | ------------ |
| did_you_mean | 1.0.0 |
| slack-notifier | 2.3.2 |
| multipart-post | 2.0.0 |
| word_wrap | 1.0.0 |
| tty-cursor | 0.5.0 |
| tty-spinner | 0.8.0 |
| babosa | 1.0.2 |
| colored | 1.2 |
| commander-fastlane | 4.4.6 |
| faraday-cookie_jar | 0.0.6 |
| mini_magick | 4.5.1 |
| security | 0.1.3 |
| bundler | 1.13.6 |
| naturally | 2.1.0 |
| simctl | 1.6.2 |
| tty-screen | 0.6.4 |
| highline | 1.7.10 |
| io-console | 0.4.5 |
| excon | 0.61.0 |
| rubyzip | 1.2.1 |
| CFPropertyList | 2.3.6 |
| mini_portile2 | 2.3.0 |
| nokogiri | 1.8.2 |
| plist | 3.4.0 |
| atomos | 0.1.2 |
| claide | 1.0.2 |
| colored2 | 3.1.2 |
| nanaimo | 0.2.4 |
| xcodeproj | 1.5.7 |
| faraday | 0.14.0 |
| faraday_middleware | 0.12.2 |
| http-cookie | 1.0.3 |
| unf | 0.1.4 |
| domain_name | 0.5.20170404 |
| os | 0.9.6 |
| googleauth | 0.6.2 |
| declarative-option | 0.1.0 |
| representable | 3.0.4 |
| mime-types-data | 3.2016.0521 |
| mime-types | 3.1 |
| google-api-client | 0.13.6 |
| signet | 0.8.1 |
| fastimage | 2.1.1 |
| json | 2.1.0 |
| terminal-table | 1.8.0 |
| unicode-display_width | 1.3.0 |
| xctest_list | 1.1.3 |
| fastlane-plugin-test_center | 3.1.3 |

generated on: 2018-04-02


♻️ multi_scan 🐞bug

Most helpful comment

Hello, excellent plugin, but I'm having the same problem, waiting for fix, thanks

All 24 comments

Thank you for the bug report. I removed some api_tokens and build_secrets from the description that you provided me.

Can you remove the option to skip_build? I think that your use of clear_derived_data is wiping out the test runner that is needed to run the tests.

The xctestrun file is created when building the app with tests and is stored in clear_derived_data. I could optionally error out if the derived data directory is empty...

@lyndsey-ferguson -- I have skip_build as true because if not, it builds twice, once for "debug" and then once for the test build. Is that not true anymore? I run 'cleear_derived_data' for a clean build everytime. Also, the 'cleear_derived_data' runs before it evens starts building right? So why would it delete the xctestrun if it hasnt even built?

With multi_scan, I am using the build for testing and test without building flags. So, if you remove the skip_build option, the action will create a build for testing, then run tests up to try_count times (without building again).

I am not very familiar with the skip_build option (which I will soon change). It could be "building" for test in a different way than I am used to.

If you can confirm that everything works with the removal of the skip_build parameter, I can look into how scan does what it does.

I tried both the suggestions: removing skip_build and removing clear_derived_data. I am still getting the same error:
bundler: failed to load command: fastlane (/usr/local/bin/fastlane)
FastlaneCore::Interface::FastlaneError: [!] Error: cannot find xctestrun file ''

But if I use scan before multi_scan it builds and runs the tests fine. Below is the updated lane I am using:

desc "Runs all the TK UI Tests"
lane :toolkit_ui_tests do
ENV['FASTLANE_XCODE_LIST_TIMEOUT'] = '120'
clear_derived_data
sh('mkdir -p ../reports/uitest-coverage/')
sh('mkdir -p ../reports/uitest-xcov-coverage/')
cocoapods(repo_update: false, silent: true) # CP repo update moved to a Jenkins task that runs once a day
scan(
scheme: "ToolkitUITests",
device: "iPhone 8",
build_for_testing: true,
fail_build: true,
code_coverage: true,
skip_build: true, # needed otherwise scan builds Toolkit twice
clean: true
)
multi_scan(
workspace: File.absolute_path('../Toolkit.xcworkspace'),
test_without_building: true,
device: "iPhone 8",
scheme: 'ToolkitUITests',
output_directory: "reports/ui-tests",
include_simulator_logs: false,
skip_build: true,
try_count: 3,
fail_build: true,
code_coverage: true,
)

Are you telling multi_scan to test_without_building when it fails?

@lyndsey-ferguson -- sorry for the confusion. I think I have fixed the lane now following your suggestion. I didn't know you were setting the flags build for testing and test without building. Now below is the lane I am using and I am not using scan anymore and I removed the skip_build option as well. (I guess in the documentation you can remove 'skip_build`)

multi_scan(
  workspace: File.absolute_path('../Toolkit.xcworkspace'),
  device: "iPhone 8",
  scheme: 'ToolkitUITests',
  output_directory: "reports/ui-tests",
  include_simulator_logs: false,
  try_count: 3,
  batch_count: 3,
  fail_build: true,
  code_coverage: true,
)

Only question I have for you is: If some of the tests fail and when it tries to rerun the failed tests, will it build again or just rerun the failed tests without building (my preference is to just rerun without building)?

Oh, it will just re-run the tests without building.

I'm going to keep this issue, but make it revolve around the difference between how multi_scan treats skip_build vs scan.

Sure, that makes sense. scan builds twice if that flag is not set to true. Thanks so much for putting together this plugin, it saves a lot of false failures for people like me.

You're very welcome!

@lyndsey-ferguson -- Had another question, when we batch the tests, it generates multiple reports, is it possible to aggregate all the reports into just 1 report?

It should do that when it finishes _unless_ there are multiple test targets. Are there multiple test targets? If so, it doesn't make sense to collate them as the format doesn't merge properly.

my UI lane only has one test target "ToolkitUItests"

What reports does it generate? When it completes, it should collate the reports into one report. You're talking about the junit reports? Or the HTML reports? If HTML, multi_scan does _not_ collate those. Nor does it collate plist reports in a results_bundle. Both are possible but not done.

HTML has 3 parts, report.html, report-2.html and report-3.html (for batch count of 3). Junit only has 1 report and as per your comment above, it seems like junit is consolidated?

Right, only junits are consolidated. If you'd like HTML reports consolidated, can you create a new Issue?

Absolutely. I will create a new issue.

Hello, excellent plugin, but I'm having the same problem, waiting for fix, thanks

Some personal notes. From what I've discovered, the :skip_build option will simply _omit_ the build parameter to xcodebuild. This means that if the project's build products already exist, xcodebuild will not build the product but just proceed to testing. If the build products do not exist, then it will build and then test.

Can I properly determine if the correct build products exist so that I can simply grab the tests for only_testing?

Can I simply pass it down to scan so that we too omit the build command, and then all the tests run the first pass. I could imagine it would also call my refactored MultiScanManager::Runner's run_first_run_of_invocation_based_tests (renaming the method) and then let the normal events unfold? That seems reasonable.

Slated to be fixed by issue-41 support skip_build

Fixed in v3.8.0

Was this page helpful?
0 / 5 - 0 ratings