fastlane-plugin-test_center 2.4.4 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9bd24fbc4c0ebeaa6e4521bbd2e75db502ca69e2
4
- data.tar.gz: 119637e14527920182c4e8fd08c9c1dfa2a59879
3
+ metadata.gz: b25348474cad13861fdf494fcb209f6c9597b924
4
+ data.tar.gz: 11b9e836b847fcff85565fae546957e6d82f78eb
5
5
  SHA512:
6
- metadata.gz: 8ab735cd7f2487505430db330f20f62e43f87186b71487dc31b4fefb937cf4a2d735163868d1624da862b965c0e8746450c81285d2cef082331cc6c8546e4ba9
7
- data.tar.gz: bbcd4d26705953ff3055b0e9b3cc7e537a6b209cc6cd9c780754f0565a69e13f2fa867569aeba42de0e50f7c1a2fc7c5ea4dbc857e727fdbf1f909fc10800933
6
+ metadata.gz: b8507c18d5c97b64cfed282105398a00a343f4bb259a1daba793a5229de2a0e838a230d1542dd174bfd3ef2d79ca57678bc538c9b496b88d855959899066ae93
7
+ data.tar.gz: 7bfed07d1fd5a1cf130016adf9c1318166ae24aa8313c2f61d1be464fe20c7c13d6411a951b77a56a2c3a915d126748c23bf49bb2fef1a4dbabf85345f0fad36
data/README.md CHANGED
@@ -23,6 +23,7 @@ This fastlane plugin includes the following actions:
23
23
  - `suppress_tests`: suppresses specific tests in a specific or all Xcode Schemes in a given project
24
24
  - `suppressed_tests`: retrieves a list of tests that are suppressed in a specific or all Xcode Schemes in a project
25
25
  - `tests_from_junit`: retrieves the failing and passing tests as reported in a junit xml file
26
+ - `tests_from_xctestrun`: retrieves all of the tests from xctest bundles referenced by the xctestrun file
26
27
  - `collate_junit_reports`: collects and correctly organizes junit reports from multiple test passes
27
28
 
28
29
  ## Example
@@ -4,6 +4,7 @@ module Fastlane
4
4
  require 'shellwords'
5
5
  require 'xctest_list'
6
6
  require 'plist'
7
+ require 'pry-byebug'
7
8
 
8
9
  class MultiScanAction < Action
9
10
  def self.run(params)
@@ -129,19 +130,8 @@ module Fastlane
129
130
  end
130
131
 
131
132
  def self.xctestrun_tests(xctestrun_path)
132
- xctestrun = Plist.parse_xml(xctestrun_path)
133
- xctestrun_rootpath = File.dirname(xctestrun_path)
134
- tests = []
135
- xctestrun.each do |testable_name, xctestrun_config|
136
- test_identifiers = XCTestList.tests(xctest_bundle_path(xctestrun_rootpath, xctestrun_config))
137
- if xctestrun_config.key?('SkipTestIdentifiers')
138
- test_identifiers.reject! { |test_identifier| xctestrun_config['SkipTestIdentifiers'].include?(test_identifier) }
139
- end
140
- tests += test_identifiers.map do |test_identifier|
141
- "#{testable_name.shellescape}/#{test_identifier}"
142
- end
143
- end
144
- tests
133
+ tests_across_testables = other_action.tests_from_xctestrun(xctestrun: xctestrun_path)
134
+ tests_across_testables.values.flatten
145
135
  end
146
136
 
147
137
  def self.xctest_bundle_path(xctestrun_rootpath, xctestrun_config)
@@ -151,7 +141,7 @@ module Fastlane
151
141
  end
152
142
 
153
143
  def self.testrun_path(scan_options)
154
- Dir.glob("#{scan_options[:derived_data_path]}/Build/Products/#{scan_options[:scheme]}*.xctestrun").first
144
+ Dir.glob("#{scan_options[:derived_data_path]}/Build/Products/*.xctestrun").first
155
145
  end
156
146
 
157
147
  def self.test_products_path(derived_data_path)
@@ -0,0 +1,64 @@
1
+ module Fastlane
2
+ module Actions
3
+ class TestsFromXctestrunAction < Action
4
+ def self.run(params)
5
+ return xctestrun_tests(params[:xctestrun])
6
+ end
7
+
8
+ def self.xctestrun_tests(xctestrun_path)
9
+ xctestrun = Plist.parse_xml(xctestrun_path)
10
+ xctestrun_rootpath = File.dirname(xctestrun_path)
11
+ tests = Hash.new([])
12
+ xctestrun.each do |testable_name, xctestrun_config|
13
+ test_identifiers = XCTestList.tests(xctest_bundle_path(xctestrun_rootpath, xctestrun_config))
14
+ if xctestrun_config.key?('SkipTestIdentifiers')
15
+ test_identifiers.reject! { |test_identifier| xctestrun_config['SkipTestIdentifiers'].include?(test_identifier) }
16
+ end
17
+ tests[testable_name] = test_identifiers.map do |test_identifier|
18
+ "#{testable_name.shellescape}/#{test_identifier}"
19
+ end
20
+ end
21
+ tests
22
+ end
23
+
24
+ def self.xctest_bundle_path(xctestrun_rootpath, xctestrun_config)
25
+ xctest_host_path = xctestrun_config['TestHostPath'].sub('__TESTROOT__', xctestrun_rootpath)
26
+ xctestrun_config['TestBundlePath'].sub!('__TESTHOST__', xctest_host_path)
27
+ xctestrun_config['TestBundlePath'].sub('__TESTROOT__', xctestrun_rootpath)
28
+ end
29
+
30
+ #####################################################
31
+ # @!group Documentation
32
+ #####################################################
33
+
34
+ def self.description
35
+ "Retrieves all of the tests from xctest bundles referenced by the xctestrun file"
36
+ end
37
+
38
+ def self.available_options
39
+ [
40
+ FastlaneCore::ConfigItem.new(
41
+ key: :xctestrun,
42
+ env_name: "FL_SUPPRESS_TESTS_FROM_XCTESTRUN_FILE",
43
+ description: "The xctestrun file to use to find where the xctest bundle file is for test retrieval",
44
+ verify_block: proc do |path|
45
+ UI.user_error!("Error: cannot find the xctestrun file '#{path}'") unless File.exist?(path)
46
+ end
47
+ )
48
+ ]
49
+ end
50
+
51
+ def self.return_value
52
+ "A Hash of testable => tests, where testable is the name of the test target and tests is an array of test identifiers"
53
+ end
54
+
55
+ def self.authors
56
+ ["lyndsey-ferguson/lyndseydf"]
57
+ end
58
+
59
+ def self.is_supported?(platform)
60
+ platform == :ios
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module TestCenter
3
- VERSION = "2.4.4"
3
+ VERSION = "2.5.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-test_center
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.4
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyndsey Ferguson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-02 00:00:00.000000000 Z
11
+ date: 2018-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj
@@ -171,7 +171,8 @@ description: |2
171
171
  3) suppress_tests: suppresses specific tests in a specific or all Xcode Schemes in a given project.
172
172
  4) suppressed_tests: retrieves a list of tests that are suppressed in a specific or all Xcode Schemes in a project.
173
173
  5) tests_from_junit: retrieves the failing and passing tests as reported in a junit xml file.
174
- 6) collate_junit_reports: collects and correctly organizes junit reports from multiple test passes.
174
+ 6) tests_from_xctestrun: retrieves all of the tests from xctest bundles referenced by the xctestrun file
175
+ 7) collate_junit_reports: collects and correctly organizes junit reports from multiple test passes.
175
176
  email: ldf.public+github@outlook.com
176
177
  executables: []
177
178
  extensions: []
@@ -186,6 +187,7 @@ files:
186
187
  - lib/fastlane/plugin/test_center/actions/suppress_tests_from_junit.rb
187
188
  - lib/fastlane/plugin/test_center/actions/suppressed_tests.rb
188
189
  - lib/fastlane/plugin/test_center/actions/tests_from_junit.rb
190
+ - lib/fastlane/plugin/test_center/actions/tests_from_xctestrun.rb
189
191
  - lib/fastlane/plugin/test_center/helper/junit_helper.rb
190
192
  - lib/fastlane/plugin/test_center/helper/test_center_helper.rb
191
193
  - lib/fastlane/plugin/test_center/helper/xcodebuild_string.rb