class Xcodeproj::XCScheme::TestAction::TestableReference

Constants

SkippedTest

Aliased to`Test` for compatibility @todo Remove in Xcodeproj 2

Public Class Methods

new(target_or_node = nil, root_project = nil) click to toggle source

@param [Xcodeproj::Project::Object::AbstractTarget, REXML::Element] target_or_node

Either the Xcode target to reference,
or an existing XML 'TestableReference' node element to reference,
or nil to create an new, empty TestableReference

@param [Xcodeproj::Project] the root project to reference from

(when nil the project of the target is used)
# 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

Public Instance Methods

add_buildable_reference(ref) click to toggle source

@param [BuildableReference] ref

The BuildableReference to add to the list of targets this action will build
# 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) click to toggle source

@param [Test] selected_test

The SelectedTest to add to the list of tests this action will run.
# 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) click to toggle source

@param [Test] skipped_test

The SkippedTest to add to the list of tests this action will skip
# 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_references() click to toggle source

@return [Array<BuildableReference>]

The list of BuildableReferences this action will build.
(The list usually contains only one element)
# 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) click to toggle source

@param [Bool] flag

Set whether or not this TestableReference (test bundle) should be run in parallel or not
# File lib/xcodeproj/scheme/test_action.rb, line 234
def parallelizable=(flag)
  @xml_element.attributes['parallelizable'] = bool_to_string(flag)
end
parallelizable?() click to toggle source

@return [Bool]

Whether or not this TestableReference (test bundle) should be run in parallel or not
# File lib/xcodeproj/scheme/test_action.rb, line 227
def parallelizable?
  string_to_bool(@xml_element.attributes['parallelizable'])
end
randomized?() click to toggle source

@return [Bool]

Whether or not this TestableReference (test bundle) should be run in randomized order.
# File lib/xcodeproj/scheme/test_action.rb, line 255
def randomized?
  test_execution_ordering == 'random'
end
remove_buildable_reference(ref) click to toggle source

@param [BuildableReference] ref

The BuildableReference to remove from the list of targets this entry will build
# File lib/xcodeproj/scheme/test_action.rb, line 279
def remove_buildable_reference(ref)
  @xml_element.delete_element(ref.xml_element)
end
selected_tests() click to toggle source

@return [Array<Test>]

The list of SelectedTest this action will run.
# 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) click to toggle source

@param [Array<Test>] tests

Set the list of SelectedTest this action will run.
# 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) click to toggle source

@param [Bool] flag

Set whether or not this TestableReference (test bundle) should be skipped or not
# File lib/xcodeproj/scheme/test_action.rb, line 220
def skipped=(flag)
  @xml_element.attributes['skipped'] = bool_to_string(flag)
end
skipped?() click to toggle source

@return [Bool]

Whether or not this TestableReference (test bundle) should be skipped or not
# File lib/xcodeproj/scheme/test_action.rb, line 213
def skipped?
  string_to_bool(@xml_element.attributes['skipped'])
end
skipped_tests() click to toggle source

@return [Array<Test>]

The list of SkippedTest this action will skip.
# 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) click to toggle source

@param [Array<Test>] tests

Set the list of SkippedTest this action will skip.
# 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_ordering() click to toggle source

@return [String]

The execution order for this TestableReference (test bundle)
# File lib/xcodeproj/scheme/test_action.rb, line 241
def test_execution_ordering
  @xml_element.attributes['testExecutionOrdering']
end
test_execution_ordering=(order) click to toggle source

@param [String] order

Set the execution order for this TestableReference (test bundle)
# 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) click to toggle source

@param [Bool] flag

Set whether or not this TestableReference (test bundle) should use a whitelist or not
# 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?() click to toggle source

@return [Bool]

Whether or not this TestableReference (test bundle) should use a whitelist or not
# File lib/xcodeproj/scheme/test_action.rb, line 318
def use_test_selection_whitelist?
  string_to_bool(@xml_element.attributes['useTestSelectionWhitelist'])
end