Class: Xcodeproj::XCScheme::TestAction::TestableReference

Inherits:
XMLElementWrapper show all
Defined in:
lib/xcodeproj/scheme/test_action.rb

Overview

————————————————————————-#

Defined Under Namespace

Classes: Test

Constant Summary collapse

SkippedTest =
TODO:

Remove in Xcodeproj 2

Aliased to`Test` for compatibility

Test

Instance Attribute Summary

Attributes inherited from XMLElementWrapper

#xml_element

Instance Method Summary collapse

Methods inherited from XMLElementWrapper

#to_s

Constructor Details

#initialize(target_or_node = nil, root_project = nil) ⇒ TestableReference



203
204
205
206
207
208
# File 'lib/xcodeproj/scheme/test_action.rb', line 203

def initialize(target_or_node = nil, root_project = nil)
  create_xml_element_with_fallback(target_or_node, 'TestableReference') do
    self.skipped = false
    add_buildable_reference BuildableReference.new(target_or_node, root_project) unless target_or_node.nil?
  end
end

Instance Method Details

#add_buildable_reference(ref) ⇒ Object



272
273
274
# File 'lib/xcodeproj/scheme/test_action.rb', line 272

def add_buildable_reference(ref)
  @xml_element.add_element(ref.xml_element)
end

#add_selected_test(selected_test) ⇒ Object



354
355
356
357
# File 'lib/xcodeproj/scheme/test_action.rb', line 354

def add_selected_test(selected_test)
  entries = @xml_element.elements['SelectedTests'] || @xml_element.add_element('SelectedTests')
  entries.add_element(selected_test.xml_element)
end

#add_skipped_test(skipped_test) ⇒ Object



310
311
312
313
# File 'lib/xcodeproj/scheme/test_action.rb', line 310

def add_skipped_test(skipped_test)
  entries = @xml_element.elements['SkippedTests'] || @xml_element.add_element('SkippedTests')
  entries.add_element(skipped_test.xml_element)
end

#buildable_referencesArray<BuildableReference>



263
264
265
266
267
# File 'lib/xcodeproj/scheme/test_action.rb', line 263

def buildable_references
  @xml_element.get_elements('BuildableReference').map do |node|
    BuildableReference.new(node)
  end
end

#parallelizable=(flag) ⇒ Object



234
235
236
# File 'lib/xcodeproj/scheme/test_action.rb', line 234

def parallelizable=(flag)
  @xml_element.attributes['parallelizable'] = bool_to_string(flag)
end

#parallelizable?Bool



227
228
229
# File 'lib/xcodeproj/scheme/test_action.rb', line 227

def parallelizable?
  string_to_bool(@xml_element.attributes['parallelizable'])
end

#randomized?Bool



255
256
257
# File 'lib/xcodeproj/scheme/test_action.rb', line 255

def randomized?
  test_execution_ordering == 'random'
end

#remove_buildable_reference(ref) ⇒ Object



279
280
281
# File 'lib/xcodeproj/scheme/test_action.rb', line 279

def remove_buildable_reference(ref)
  @xml_element.delete_element(ref.xml_element)
end

#selected_testsArray<Test>



332
333
334
335
336
337
# File 'lib/xcodeproj/scheme/test_action.rb', line 332

def selected_tests
  return [] if @xml_element.elements['SelectedTests'].nil?
  @xml_element.elements['SelectedTests'].get_elements('Test').map do |node|
    Test.new(node)
  end
end

#selected_tests=(tests) ⇒ Object



342
343
344
345
346
347
348
349
# File 'lib/xcodeproj/scheme/test_action.rb', line 342

def selected_tests=(tests)
  @xml_element.delete_element('SelectedTests')
  return if tests.nil?
  entries = @xml_element.add_element('SelectedTests')
  tests.each do |selected|
    entries.add_element(selected.xml_element)
  end
end

#skipped=(flag) ⇒ Object



220
221
222
# File 'lib/xcodeproj/scheme/test_action.rb', line 220

def skipped=(flag)
  @xml_element.attributes['skipped'] = bool_to_string(flag)
end

#skipped?Bool



213
214
215
# File 'lib/xcodeproj/scheme/test_action.rb', line 213

def skipped?
  string_to_bool(@xml_element.attributes['skipped'])
end

#skipped_testsArray<Test>



286
287
288
289
290
291
# File 'lib/xcodeproj/scheme/test_action.rb', line 286

def skipped_tests
  return [] if @xml_element.elements['SkippedTests'].nil?
  @xml_element.elements['SkippedTests'].get_elements('Test').map do |node|
    Test.new(node)
  end
end

#skipped_tests=(tests) ⇒ Object



296
297
298
299
300
301
302
303
304
305
# File 'lib/xcodeproj/scheme/test_action.rb', line 296

def skipped_tests=(tests)
  @xml_element.delete_element('SkippedTests')
  if tests.nil?
    return
  end
  entries = @xml_element.add_element('SkippedTests')
  tests.each do |skipped|
    entries.add_element(skipped.xml_element)
  end
end

#test_execution_orderingString



241
242
243
# File 'lib/xcodeproj/scheme/test_action.rb', line 241

def test_execution_ordering
  @xml_element.attributes['testExecutionOrdering']
end

#test_execution_ordering=(order) ⇒ Object



248
249
250
# File 'lib/xcodeproj/scheme/test_action.rb', line 248

def test_execution_ordering=(order)
  @xml_element.attributes['testExecutionOrdering'] = order
end

#use_test_selection_whitelist=(flag) ⇒ Object



325
326
327
# File 'lib/xcodeproj/scheme/test_action.rb', line 325

def use_test_selection_whitelist=(flag)
  @xml_element.attributes['useTestSelectionWhitelist'] = bool_to_string(flag)
end

#use_test_selection_whitelist?Bool



318
319
320
# File 'lib/xcodeproj/scheme/test_action.rb', line 318

def use_test_selection_whitelist?
  string_to_bool(@xml_element.attributes['useTestSelectionWhitelist'])
end