Class: CemAcpt::Bolt::Tests::TestList
- Inherits:
-
Object
- Object
- CemAcpt::Bolt::Tests::TestList
- Includes:
- Logging
- Defined in:
- lib/cem_acpt/bolt/tests.rb
Overview
Loads test data and provides an interface for running tests against Bolt tasks
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#inventory ⇒ Object
Returns the value of attribute inventory.
-
#project ⇒ Object
Returns the value of attribute project.
-
#run_data ⇒ Object
Returns the value of attribute run_data.
-
#tasks ⇒ Object
readonly
Returns the value of attribute tasks.
-
#test_data ⇒ Object
readonly
Returns the value of attribute test_data.
-
#tests ⇒ Object
readonly
Returns the value of attribute tests.
Instance Method Summary collapse
-
#initialize(config = nil, run_data = nil, inventory = nil, project = nil) ⇒ TestList
constructor
A new instance of TestList.
- #inspect ⇒ Object
- #length ⇒ Object (also: #count, #size)
-
#load! ⇒ Object
Loads the test data from the Bolt test files specified in the run data.
- #loaded? ⇒ Boolean
-
#setup! ⇒ Object
Sets up the tests by loading the Bolt tasks and creating a TestWrapper for each test.
- #setup? ⇒ Boolean
- #split_into_groups(num_groups) ⇒ Object
- #to_a ⇒ Object
- #to_s ⇒ Object
Methods included from Logging
current_log_config, #current_log_config, current_log_format, #current_log_format, #current_log_level, current_log_level, included, #logger, logger, new_log_config, #new_log_config, new_log_formatter, #new_log_formatter, #new_log_level, new_log_level, #new_logger, new_logger, verbose?, #verbose?
Constructor Details
#initialize(config = nil, run_data = nil, inventory = nil, project = nil) ⇒ TestList
Returns a new instance of TestList.
313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/cem_acpt/bolt/tests.rb', line 313 def initialize(config = nil, run_data = nil, inventory = nil, project = nil) @config = config @run_data = run_data @inventory = inventory @project = project @test_data = nil @tasks = [] @tests = [] @loaded = false @setup = false end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
310 311 312 |
# File 'lib/cem_acpt/bolt/tests.rb', line 310 def config @config end |
#inventory ⇒ Object
Returns the value of attribute inventory.
310 311 312 |
# File 'lib/cem_acpt/bolt/tests.rb', line 310 def inventory @inventory end |
#project ⇒ Object
Returns the value of attribute project.
310 311 312 |
# File 'lib/cem_acpt/bolt/tests.rb', line 310 def project @project end |
#run_data ⇒ Object
Returns the value of attribute run_data.
310 311 312 |
# File 'lib/cem_acpt/bolt/tests.rb', line 310 def run_data @run_data end |
#tasks ⇒ Object (readonly)
Returns the value of attribute tasks.
311 312 313 |
# File 'lib/cem_acpt/bolt/tests.rb', line 311 def tasks @tasks end |
#test_data ⇒ Object (readonly)
Returns the value of attribute test_data.
311 312 313 |
# File 'lib/cem_acpt/bolt/tests.rb', line 311 def test_data @test_data end |
#tests ⇒ Object (readonly)
Returns the value of attribute tests.
311 312 313 |
# File 'lib/cem_acpt/bolt/tests.rb', line 311 def tests @tests end |
Instance Method Details
#inspect ⇒ Object
372 373 374 |
# File 'lib/cem_acpt/bolt/tests.rb', line 372 def inspect to_s end |
#length ⇒ Object Also known as: count, size
362 363 364 |
# File 'lib/cem_acpt/bolt/tests.rb', line 362 def length @tests.length end |
#load! ⇒ Object
Loads the test data from the Bolt test files specified in the run data
326 327 328 329 330 331 332 |
# File 'lib/cem_acpt/bolt/tests.rb', line 326 def load! return if loaded? raise 'Run data has not been set, assign it to the #run_data attribute first' unless @run_data @test_data = load_test_data(@run_data) @loaded = true end |
#loaded? ⇒ Boolean
334 335 336 |
# File 'lib/cem_acpt/bolt/tests.rb', line 334 def loaded? @loaded end |
#setup! ⇒ Object
Sets up the tests by loading the Bolt tasks and creating a TestWrapper for each test
339 340 341 342 343 344 345 346 |
# File 'lib/cem_acpt/bolt/tests.rb', line 339 def setup! load! unless loaded? @tasks = CemAcpt::Bolt::TaskList.new(@config) @tasks.tasks # Ensure tasks are loaded logger.verbose('CemAcpt::Bolt::Tests') { "TaskList metadata:\n#{@tasks..to_yaml}" } @tests = new_test_array(@tasks, @test_data) @setup = true end |
#setup? ⇒ Boolean
348 349 350 |
# File 'lib/cem_acpt/bolt/tests.rb', line 348 def setup? @setup end |
#split_into_groups(num_groups) ⇒ Object
356 357 358 359 360 |
# File 'lib/cem_acpt/bolt/tests.rb', line 356 def split_into_groups(num_groups) raise 'Tests have not been setup, call the #setup! method first' unless setup? @tests.split_into_groups(num_groups) end |
#to_a ⇒ Object
352 353 354 |
# File 'lib/cem_acpt/bolt/tests.rb', line 352 def to_a @tests end |
#to_s ⇒ Object
368 369 370 |
# File 'lib/cem_acpt/bolt/tests.rb', line 368 def to_s "#<#{self.class}:#{object_id.to_s(16)} #{tests.join(',')}>" end |