Class: Rutema::Runners::Default
- Inherits:
-
Object
- Object
- Rutema::Runners::Default
- Includes:
- Messaging
- Defined in:
- lib/rutema/core/runner.rb
Overview
The default test runner
Direct Known Subclasses
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#setup ⇒ Object
Returns the value of attribute setup.
-
#teardown ⇒ Object
Returns the value of attribute teardown.
Instance Method Summary collapse
-
#initialize(context, queue) ⇒ Default
constructor
A new instance of Default.
- #run(spec, is_special = false) ⇒ Object
Methods included from Messaging
Constructor Details
#initialize(context, queue) ⇒ Default
Returns a new instance of Default.
14 15 16 17 18 19 20 21 |
# File 'lib/rutema/core/runner.rb', line 14 def initialize(context, queue) @setup = nil @teardown = nil @context = context || {} @queue = queue @number_of_runs = 0 @cleanup_blocks = [] end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
11 12 13 |
# File 'lib/rutema/core/runner.rb', line 11 def context @context end |
#setup ⇒ Object
Returns the value of attribute setup.
12 13 14 |
# File 'lib/rutema/core/runner.rb', line 12 def setup @setup end |
#teardown ⇒ Object
Returns the value of attribute teardown.
12 13 14 |
# File 'lib/rutema/core/runner.rb', line 12 def teardown @teardown end |
Instance Method Details
#run(spec, is_special = false) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rutema/core/runner.rb', line 23 def run(spec, is_special = false) @context["spec_name"] = spec.name steps = [] run_status = :success state = { "start_time" => Time.now, "sequence_id" => @number_of_runs, :test => spec.name } (:test => spec.name, :text => "started") if @setup (:test => spec.name, :text => "setup") run_status, steps = execute_and_collect_state("_setup_", @setup.scenario, true, run_status, steps) end if run_status == :error (:test => spec.name, "number" => 0, "status" => :error, "out" => "Setup failed", "err" => "", "duration" => 0) else (:test => spec.name, :text => "running") run_status, steps = execute_and_collect_state(spec.name, spec.scenario, is_special, run_status, steps) end @context["rutema_status"] = run_status if @teardown (:test => spec.name, :text => "teardown") run_status, steps = execute_and_collect_state("_teardown_", @teardown.scenario, true, run_status, steps) end wrap_up_execution(run_status, steps, spec, state) ensure ensure_cleanup_on_exception end |