Class: Fastlane::Actions::DisabledTestsAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/saucectl/actions/disabled_tests_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



63
64
65
# File 'lib/fastlane/plugin/saucectl/actions/disabled_tests_action.rb', line 63

def self.authors
  ["Ian Hamilton"]
end

.available_optionsObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/fastlane/plugin/saucectl/actions/disabled_tests_action.rb', line 39

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :platform,
                                 description: "application under test platform (ios or android)",
                                 optional: false,
                                 is_string: true,
                                 verify_block: proc do |value|
                                   UI.user_error!(@messages['platform_error']) if value.to_s.empty?
                                 end),
    FastlaneCore::ConfigItem.new(key: :path_to_tests,
                                 description: "Android only, path to espresso tests. Default to app/src/androidTest",
                                 optional: true,
                                 is_string: true),
    FastlaneCore::ConfigItem.new(key: :test_plan,
                                 description: "Name of xcode test plan",
                                 optional: true,
                                 is_string: true),
    FastlaneCore::ConfigItem.new(key: :test_target,
                                 description: "Name of xcode test target",
                                 optional: true,
                                 is_string: true)
  ]
end

.categoryObject



67
68
69
# File 'lib/fastlane/plugin/saucectl/actions/disabled_tests_action.rb', line 67

def self.category
  :testing
end

.descriptionObject



31
32
33
# File 'lib/fastlane/plugin/saucectl/actions/disabled_tests_action.rb', line 31

def self.description
  "Fetches any disabled ui test cases (for android searches for @Ignore tests, and for ios skipped tests within an xcode test plan). Will be used in future for generating pretty HTML reports"
end

.detailsObject



35
36
37
# File 'lib/fastlane/plugin/saucectl/actions/disabled_tests_action.rb', line 35

def self.details
  "Fetches any disabled ui test cases (for android searches for @Ignore tests, and for ios skipped tests within an xcode test plan). Will be used in future for generating pretty HTML reports"
end

.example_codeObject



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/fastlane/plugin/saucectl/actions/disabled_tests_action.rb', line 75

def self.example_code
  [
    "disabled_tests({ platform: 'android',
                      path_to_tests: 'my-demo-app-android/app/src/androidTest'
    })",
    "disabled_tests({ platform: 'ios',
                      test_plan: 'UITests'
    })",
    "disabled_tests({ platform: 'ios',
                      test_plan: 'UITests'
    })"
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/fastlane/plugin/saucectl/actions/disabled_tests_action.rb', line 71

def self.is_supported?(platform)
  [:ios, :android].include?(platform)
end

.run(params) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/fastlane/plugin/saucectl/actions/disabled_tests_action.rb', line 12

def self.run(params)
  verify_config(params)
  if params[:platform].eql?('android')
    params[:path_to_tests] ? params[:path_to_tests] : params[:path_to_tests] = "app/src/androidTest"
    Fastlane::Saucectl::Espresso.new(params).fetch_disabled_tests(params[:path_to_tests])
  else
    Fastlane::Saucectl::XCTest.new(params).fetch_disabled_tests
  end
end

.verify_config(params) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/fastlane/plugin/saucectl/actions/disabled_tests_action.rb', line 22

def self.verify_config(params)
  if params[:platform].eql?('ios') && params[:test_plan].nil?
    UI.user_error!('Cannot get skipped tests for an ios project without a known test_plan')
  end
  if params[:platform].eql?('android') && !params[:test_plan].nil?
    UI.user_error!('test_plan option is reserved for ios projects only')
  end
end