Class: Xcodeproj::XCScheme::TestAction
Overview
This class wraps the TestAction node of a .xcscheme XML file
Defined Under Namespace
Classes: TestableReference
Instance Attribute Summary
#xml_element
Instance Method Summary
collapse
#add_post_action, #add_pre_action, #build_configuration, #build_configuration=, #post_actions, #post_actions=, #pre_actions, #pre_actions=
#to_s
Constructor Details
#initialize(node = nil) ⇒ TestAction
12
13
14
15
16
17
18
19
20
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 12
def initialize(node = nil)
create_xml_element_with_fallback(node, 'TestAction') do
self.build_configuration = 'Debug'
@xml_element.attributes['selectedDebuggerIdentifier'] = 'Xcode.DebuggerFoundation.Debugger.LLDB'
@xml_element.attributes['selectedLauncherIdentifier'] = 'Xcode.DebuggerFoundation.Launcher.LLDB'
self.should_use_launch_scheme_args_env = true
@xml_element.add_element('Testables')
end
end
|
Instance Method Details
#add_code_coverage_target(buildable_reference) ⇒ Object
183
184
185
186
187
188
189
190
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 183
def add_code_coverage_target(buildable_reference)
@xml_element.attributes['onlyGenerateCoverageForSpecifiedTargets'] = bool_to_string(true)
coverage_targets_element = @xml_element.elements['CodeCoverageTargets'] || @xml_element.add_element('CodeCoverageTargets')
coverage_targets_element.add_element(buildable_reference.xml_element)
code_coverage_targets
end
|
#add_macro_expansion(macro_expansion) ⇒ Object
111
112
113
114
115
116
117
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 111
def add_macro_expansion(macro_expansion)
if testables = @xml_element.elements['Testables']
@xml_element.insert_before(testables, macro_expansion.xml_element)
else
@xml_element.add_element(macro_expansion.xml_element)
end
end
|
#add_testable(testable) ⇒ Object
94
95
96
97
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 94
def add_testable(testable)
testables = @xml_element.elements['Testables'] || @xml_element.add_element('Testables')
testables.add_element(testable.xml_element)
end
|
#code_coverage_enabled=(flag) ⇒ Object
64
65
66
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 64
def code_coverage_enabled=(flag)
@xml_element.attributes['codeCoverageEnabled'] = bool_to_string(flag)
end
|
#code_coverage_enabled? ⇒ Bool
57
58
59
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 57
def code_coverage_enabled?
string_to_bool(@xml_element.attributes['codeCoverageEnabled'])
end
|
157
158
159
160
161
162
163
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 157
def code_coverage_targets
return [] unless @xml_element.elements['CodeCoverageTargets']
@xml_element.elements['CodeCoverageTargets'].get_elements('BuildableReference').map do |node|
BuildableReference.new(node)
end
end
|
#code_coverage_targets=(buildable_references) ⇒ Object
168
169
170
171
172
173
174
175
176
177
178
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 168
def code_coverage_targets=(buildable_references)
@xml_element.attributes['onlyGenerateCoverageForSpecifiedTargets'] = bool_to_string(true)
@xml_element.delete_element('CodeCoverageTargets')
coverage_targets_element = @xml_element.add_element('CodeCoverageTargets')
buildable_references.each do |reference|
coverage_targets_element.add_element(reference.xml_element)
end
code_coverage_targets
end
|
141
142
143
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 141
def command_line_arguments
CommandLineArguments.new(@xml_element.elements[XCScheme::COMMAND_LINE_ARGS_NODE])
end
|
148
149
150
151
152
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 148
def command_line_arguments=(arguments)
@xml_element.delete_element(XCScheme::COMMAND_LINE_ARGS_NODE)
@xml_element.add_element(arguments.xml_element) if arguments
arguments
end
|
#disable_main_thread_checker=(flag) ⇒ Object
50
51
52
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 50
def disable_main_thread_checker=(flag)
@xml_element.attributes['disableMainThreadChecker'] = bool_to_string(flag)
end
|
#disable_main_thread_checker? ⇒ Bool
42
43
44
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 42
def disable_main_thread_checker?
string_to_bool(@xml_element.attributes['disableMainThreadChecker'])
end
|
122
123
124
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 122
def environment_variables
EnvironmentVariables.new(@xml_element.elements[XCScheme::VARIABLES_NODE])
end
|
130
131
132
133
134
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 130
def environment_variables=(env_vars)
@xml_element.delete_element(XCScheme::VARIABLES_NODE)
@xml_element.add_element(env_vars.xml_element) if env_vars
env_vars
end
|
102
103
104
105
106
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 102
def macro_expansions
@xml_element.get_elements('MacroExpansion').map do |node|
MacroExpansion.new(node)
end
end
|
#should_use_launch_scheme_args_env=(flag) ⇒ Object
34
35
36
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 34
def should_use_launch_scheme_args_env=(flag)
@xml_element.attributes['shouldUseLaunchSchemeArgsEnv'] = bool_to_string(flag)
end
|
#should_use_launch_scheme_args_env? ⇒ Bool
26
27
28
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 26
def should_use_launch_scheme_args_env?
string_to_bool(@xml_element.attributes['shouldUseLaunchSchemeArgsEnv'])
end
|
71
72
73
74
75
76
77
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 71
def testables
return [] unless @xml_element.elements['Testables']
@xml_element.elements['Testables'].get_elements('TestableReference').map do |node|
TestableReference.new(node)
end
end
|
#testables=(testables) ⇒ Object
82
83
84
85
86
87
88
89
|
# File 'lib/xcodeproj/scheme/test_action.rb', line 82
def testables=(testables)
@xml_element.delete_element('Testables')
testables_element = @xml_element.add_element('Testables')
testables.each do |testable|
testables_element.add_element(testable.xml_element)
end
testables
end
|