Class: TestCenter::Helper::TestCollector
- Inherits:
-
Object
- Object
- TestCenter::Helper::TestCollector
- Defined in:
- lib/fastlane/plugin/retry_tests/helper/test_collector.rb
Instance Method Summary collapse
- #derived_testrun_path(derived_data_path, scheme) ⇒ Object
-
#initialize(options) ⇒ TestCollector
constructor
A new instance of TestCollector.
- #only_testing_to_testables_tests ⇒ Object
- #testables ⇒ Object
- #testables_tests ⇒ Object
Constructor Details
#initialize(options) ⇒ TestCollector
7 8 9 10 11 |
# File 'lib/fastlane/plugin/retry_tests/helper/test_collector.rb', line 7 def initialize() @xctestrun_path = [:xctestrun] || derived_testrun_path([:derived_data_path], [:scheme]) @only_testing = [:only_testing] @skip_testing = [:skip_testing] end |
Instance Method Details
#derived_testrun_path(derived_data_path, scheme) ⇒ Object
13 14 15 |
# File 'lib/fastlane/plugin/retry_tests/helper/test_collector.rb', line 13 def derived_testrun_path(derived_data_path, scheme) Dir.glob("#{derived_data_path}/Build/Products/#{scheme}*.xctestrun").first end |
#only_testing_to_testables_tests ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/fastlane/plugin/retry_tests/helper/test_collector.rb', line 28 def only_testing_to_testables_tests tests = Hash.new { |h, k| h[k] = [] } @only_testing.sort.each do |test_identifier| testable = test_identifier.split('/', 2)[0] tests[testable] << test_identifier end tests end |
#testables ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fastlane/plugin/retry_tests/helper/test_collector.rb', line 17 def testables unless @testables if @only_testing @testables ||= only_testing_to_testables_tests.keys else @testables ||= Plist.parse_xml(@xctestrun_path).keys end end @testables end |
#testables_tests ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fastlane/plugin/retry_tests/helper/test_collector.rb', line 37 def testables_tests unless @testables_tests if @only_testing @testables_tests = only_testing_to_testables_tests else config = FastlaneCore::Configuration.create(::Fastlane::Actions::TestsFromXctestrunAction., xctestrun: @xctestrun_path) @testables_tests = ::Fastlane::Actions::TestsFromXctestrunAction.run(config) if @skip_testing skipped_testable_tests = Hash.new { |h, k| h[k] = [] } @skip_testing.sort.each do |skipped_test_identifier| testable = skipped_test_identifier.split('/', 2)[0] skipped_testable_tests[testable] << skipped_test_identifier end @testables_tests.each_key do |testable| @testables_tests[testable] -= skipped_testable_tests[testable] end end end end @testables_tests end |