class Fastlane::Actions::TestsFromXctestrunAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/retry_tests/actions/tests_from_xctestrun.rb, line 56
def self.authors
  ["lyndsey-ferguson/lyndseydf"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/retry_tests/actions/tests_from_xctestrun.rb, line 39
def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :xctestrun,
      env_name: "FL_SUPPRESS_TESTS_FROM_XCTESTRUN_FILE",
      description: "The xctestrun file to use to find where the xctest bundle file is for test retrieval",
      verify_block: proc do |path|
        UI.user_error!("Error: cannot find the xctestrun file '#{path}'") unless File.exist?(path)
      end
    )
  ]
end
description() click to toggle source

@!group Documentation

# File lib/fastlane/plugin/retry_tests/actions/tests_from_xctestrun.rb, line 35
def self.description
  "Retrieves all of the tests from xctest bundles referenced by the xctestrun file"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/retry_tests/actions/tests_from_xctestrun.rb, line 60
def self.is_supported?(platform)
  platform == :ios
end
return_value() click to toggle source
# File lib/fastlane/plugin/retry_tests/actions/tests_from_xctestrun.rb, line 52
def self.return_value
  "A Hash of testable => tests, where testable is the name of the test target and tests is an array of test identifiers"
end
run(params) click to toggle source
# File lib/fastlane/plugin/retry_tests/actions/tests_from_xctestrun.rb, line 6
def self.run(params)
  return xctestrun_tests(params[:xctestrun])
end
xctest_bundle_path(xctestrun_rootpath, xctestrun_config) click to toggle source
# File lib/fastlane/plugin/retry_tests/actions/tests_from_xctestrun.rb, line 26
def self.xctest_bundle_path(xctestrun_rootpath, xctestrun_config)
  xctest_host_path = xctestrun_config['TestHostPath'].sub('__TESTROOT__', xctestrun_rootpath)
  xctestrun_config['TestBundlePath'].sub('__TESTHOST__', xctest_host_path).sub('__TESTROOT__', xctestrun_rootpath)
end
xctestrun_tests(xctestrun_path) click to toggle source
# File lib/fastlane/plugin/retry_tests/actions/tests_from_xctestrun.rb, line 10
def self.xctestrun_tests(xctestrun_path)
  xctestrun = Plist.parse_xml(xctestrun_path)
  xctestrun_rootpath = File.dirname(xctestrun_path)
  tests = Hash.new([])
  xctestrun.each do |testable_name, xctestrun_config|
    test_identifiers = XCTestList.tests(xctest_bundle_path(xctestrun_rootpath, xctestrun_config))
    if xctestrun_config.key?('SkipTestIdentifiers')
      test_identifiers.reject! { |test_identifier| xctestrun_config['SkipTestIdentifiers'].include?(test_identifier) }
    end
    tests[testable_name] = test_identifiers.map do |test_identifier|
      "#{testable_name.shellescape}/#{test_identifier}"
    end
  end
  tests
end