Class: TripAdvisor::TestTasks
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- TripAdvisor::TestTasks
- Includes:
- Rake::DSL
- Defined in:
- lib/trip_advisor/rake_tasks.rb
Instance Attribute Summary collapse
-
#environment_variables ⇒ Object
Returns the value of attribute environment_variables.
-
#ios_versions ⇒ Object
Returns the value of attribute ios_versions.
-
#namespace_name ⇒ Object
readonly
Returns the value of attribute namespace_name.
-
#prepare_dependency ⇒ Object
readonly
Returns the value of attribute prepare_dependency.
-
#runner ⇒ Object
Returns the value of attribute runner.
-
#schemes ⇒ Object
Returns the value of attribute schemes.
-
#schemes_dir ⇒ Object
Returns the value of attribute schemes_dir.
-
#settings ⇒ Object
Returns the value of attribute settings.
-
#test_devices ⇒ Object
Returns the value of attribute test_devices.
-
#workspace ⇒ Object
Returns the value of attribute workspace.
-
#xcodebuild_path ⇒ Object
Returns the value of attribute xcodebuild_path.
-
#xctool_path ⇒ Object
Returns the value of attribute xctool_path.
Instance Method Summary collapse
- #define_tasks ⇒ Object
-
#initialize(namespace_name = :test) {|_self| ... } ⇒ TestTasks
constructor
A new instance of TestTasks.
Constructor Details
#initialize(namespace_name = :test) {|_self| ... } ⇒ TestTasks
Returns a new instance of TestTasks.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/trip_advisor/rake_tasks.rb', line 90 def initialize(namespace_name = :test) @namespace_name = namespace_name.is_a?(Hash) ? namespace_name.keys.first : namespace_name @prepare_dependency = namespace_name.is_a?(Hash) ? namespace_name.values.first : nil @schemes_dir = 'Tests/Schemes' @ios_versions = %w{8.4 9.0} @xctool_path = 'xctool' @xcodebuild_path = 'xcodebuild' @runner = :xctool @settings = {} @environment_variables = '' yield self if block_given? raise "A workspace must be configured" unless workspace raise "At least one scheme must be configured" unless schemes raise "At least one test device must be configured" unless test_devices define_tasks end |
Instance Attribute Details
#environment_variables ⇒ Object
Returns the value of attribute environment_variables.
87 88 89 |
# File 'lib/trip_advisor/rake_tasks.rb', line 87 def environment_variables @environment_variables end |
#ios_versions ⇒ Object
Returns the value of attribute ios_versions.
86 87 88 |
# File 'lib/trip_advisor/rake_tasks.rb', line 86 def ios_versions @ios_versions end |
#namespace_name ⇒ Object (readonly)
Returns the value of attribute namespace_name.
85 86 87 |
# File 'lib/trip_advisor/rake_tasks.rb', line 85 def namespace_name @namespace_name end |
#prepare_dependency ⇒ Object (readonly)
Returns the value of attribute prepare_dependency.
85 86 87 |
# File 'lib/trip_advisor/rake_tasks.rb', line 85 def prepare_dependency @prepare_dependency end |
#runner ⇒ Object
Returns the value of attribute runner.
87 88 89 |
# File 'lib/trip_advisor/rake_tasks.rb', line 87 def runner @runner end |
#schemes ⇒ Object
Returns the value of attribute schemes.
86 87 88 |
# File 'lib/trip_advisor/rake_tasks.rb', line 86 def schemes @schemes end |
#schemes_dir ⇒ Object
Returns the value of attribute schemes_dir.
86 87 88 |
# File 'lib/trip_advisor/rake_tasks.rb', line 86 def schemes_dir @schemes_dir end |
#settings ⇒ Object
Returns the value of attribute settings.
88 89 90 |
# File 'lib/trip_advisor/rake_tasks.rb', line 88 def settings @settings end |
#test_devices ⇒ Object
Returns the value of attribute test_devices.
88 89 90 |
# File 'lib/trip_advisor/rake_tasks.rb', line 88 def test_devices @test_devices end |
#workspace ⇒ Object
Returns the value of attribute workspace.
86 87 88 |
# File 'lib/trip_advisor/rake_tasks.rb', line 86 def workspace @workspace end |
#xcodebuild_path ⇒ Object
Returns the value of attribute xcodebuild_path.
87 88 89 |
# File 'lib/trip_advisor/rake_tasks.rb', line 87 def xcodebuild_path @xcodebuild_path end |
#xctool_path ⇒ Object
Returns the value of attribute xctool_path.
87 88 89 |
# File 'lib/trip_advisor/rake_tasks.rb', line 87 def xctool_path @xctool_path end |
Instance Method Details
#define_tasks ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/trip_advisor/rake_tasks.rb', line 113 def define_tasks namespace self.namespace_name do task (prepare_dependency ? { prepare: prepare_dependency} : :prepare ) do run(%Q{mkdir -p "#{workspace}/xcshareddata/xcschemes" && cp Tests/Schemes/*.xcscheme "#{workspace}/xcshareddata/xcschemes/"}) end # Iterate across the schemes and define a task for each version of iOS and an aggregate task schemes.each do |scheme_namespace, scheme_names| scheme_names_array = scheme_names.is_a?(Array) ? scheme_names : [scheme_names] namespace scheme_namespace do scheme_names_array.each do |scheme_name| ios_versions.each do |ios_version| namespace ios_version do test_devices.each do |test_device| next unless test_device.valid_for?(scheme_name) desc "Run #{scheme_namespace} tests against #{ios_version} SDK on #{test_device}" task test_device.short_name => :prepare do test_scheme(scheme_name, namespace: scheme_namespace, ios_version: ios_version, test_device: test_device) end end end desc "Run #{scheme_namespace} tests against #{ios_version} SDK on valid devices" task "#{ios_version}" => test_devices.select { |test_device| test_device.valid_for?(scheme_name) }.map { |test_device| "#{scheme_namespace}:#{ios_version}:#{test_device.short_name}" } end end end desc "Run #{scheme_namespace} tests against all SDKs and valid devices" task scheme_namespace => ios_versions.map { |ios_version| "#{scheme_namespace}:#{ios_version}" } end end desc "Run the #{schemes.keys.join(', ')} tests on all devices and SDKs" task namespace_name => schemes.keys.map { |scheme| "#{namespace_name}:#{scheme}" } do TripAdvisor::TestReport.instance.report end end |