Class: Fastlane::Actions::TrainerAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/trainer.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, deprecated_notes, details, example_code, lane_context, method_missing, other_action, output, return_type, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject



27
28
29
# File 'fastlane/lib/fastlane/actions/trainer.rb', line 27

def self.authors
  ["KrauseFx"]
end

.available_optionsObject



35
36
37
38
# File 'fastlane/lib/fastlane/actions/trainer.rb', line 35

def self.available_options
  require 'trainer'
  FastlaneCore::CommanderGenerator.new.generate(Trainer::Options.available_options)
end

.categoryObject



44
45
46
# File 'fastlane/lib/fastlane/actions/trainer.rb', line 44

def self.category
  :testing
end

.descriptionObject



19
20
21
# File 'fastlane/lib/fastlane/actions/trainer.rb', line 19

def self.description
  "Convert the Xcode plist log to a JUnit report"
end

.detailObject



23
24
25
# File 'fastlane/lib/fastlane/actions/trainer.rb', line 23

def self.detail
  "Convert the Xcode plist log to a JUnit report. This will raise an exception if the tests failed"
end

.is_supported?(platform) ⇒ Boolean

Returns:



40
41
42
# File 'fastlane/lib/fastlane/actions/trainer.rb', line 40

def self.is_supported?(platform)
  %i[ios mac].include?(platform)
end

.return_valueObject



31
32
33
# File 'fastlane/lib/fastlane/actions/trainer.rb', line 31

def self.return_value
  "A hash with the key being the path of the generated file, the value being if the tests were successful"
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'fastlane/lib/fastlane/actions/trainer.rb', line 4

def self.run(params)
  require "trainer"

  params[:path] = Actions.lane_context[Actions::SharedValues::SCAN_GENERATED_PLIST_FILE] if Actions.lane_context[Actions::SharedValues::SCAN_GENERATED_PLIST_FILE]
  params[:path] ||= Actions.lane_context[Actions::SharedValues::SCAN_DERIVED_DATA_PATH] if Actions.lane_context[Actions::SharedValues::SCAN_DERIVED_DATA_PATH]

  fail_build = params[:fail_build]
  resulting_paths = Trainer::TestParser.auto_convert(params)
  resulting_paths.each do |path, test_results|
    UI.test_failure!("Unit tests failed") if fail_build && !test_results[:successful]
  end

  return resulting_paths
end