Class: Fastlane::Actions::TestsFromXctestrunAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::TestsFromXctestrunAction
- Defined in:
- lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
Class Method Summary collapse
- .run(params) ⇒ Object
- .xctest_bundle_path(xctestrun_rootpath, xctestrun_config) ⇒ Object
- .xctestrun_tests(xctestrun_path) ⇒ Object
Class Method Details
.authors ⇒ Object
84 85 86 |
# File 'lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb', line 84 def self. ["lyndsey-ferguson/lyndseydf"] end |
.available_options ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb', line 39 def self. [ 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 ⇒ Object
35 36 37 |
# File 'lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb', line 35 def self.description "Retrieves all of the tests from xctest bundles referenced by the xctestrun file" end |
.example_code ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb', line 56 def self.example_code [ " require 'fastlane/actions/scan' UI.important( 'example: ' \\ 'get list of tests that are referenced from an xctestrun file' ) # build the tests so that we have a xctestrun file to parse scan( build_for_testing: true, workspace: File.absolute_path('../AtomicBoy/AtomicBoy.xcworkspace'), scheme: 'AtomicBoy' ) # find the xctestrun file derived_data_path = Scan.config[:derived_data_path] xctestrun_file = Dir.glob(\"\#{derived_data_path}/Build/Products/*.xctestrun\").first # get the tests from the xctestrun file tests = tests_from_xctestrun(xctestrun: xctestrun_file) UI.header('xctestrun file contains the following tests') tests.values.flatten.each { |test_identifier| puts test_identifier } " ] end |
.is_supported?(platform) ⇒ Boolean
88 89 90 |
# File 'lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb', line 88 def self.is_supported?(platform) platform == :ios end |
.return_value ⇒ Object
52 53 54 |
# File 'lib/fastlane/plugin/test_center/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) ⇒ Object
6 7 8 |
# File 'lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb', line 6 def self.run(params) return xctestrun_tests(params[:xctestrun]) end |
.xctest_bundle_path(xctestrun_rootpath, xctestrun_config) ⇒ Object
26 27 28 29 |
# File 'lib/fastlane/plugin/test_center/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) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fastlane/plugin/test_center/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 |