Class: DTest::Global::Harness
- Inherits:
-
Object
- Object
- DTest::Global::Harness
- Includes:
- Hook
- Defined in:
- lib/dtest/global.rb
Instance Attribute Summary collapse
-
#after ⇒ Object
Returns the value of attribute after.
-
#before ⇒ Object
Returns the value of attribute before.
-
#global ⇒ Object
Returns the value of attribute global.
Instance Method Summary collapse
- #execute_after(list, context) ⇒ Object
- #execute_testcase(global_result, testcase) ⇒ Object
-
#initialize ⇒ Harness
constructor
A new instance of Harness.
- #start(testcases) ⇒ Object
Methods included from Hook
Constructor Details
#initialize ⇒ Harness
Returns a new instance of Harness.
10 11 12 13 |
# File 'lib/dtest/global.rb', line 10 def initialize @before = [] @after = [] end |
Instance Attribute Details
#after ⇒ Object
Returns the value of attribute after.
8 9 10 |
# File 'lib/dtest/global.rb', line 8 def after @after end |
#before ⇒ Object
Returns the value of attribute before.
8 9 10 |
# File 'lib/dtest/global.rb', line 8 def before @before end |
#global ⇒ Object
Returns the value of attribute global.
7 8 9 |
# File 'lib/dtest/global.rb', line 7 def global @global end |
Instance Method Details
#execute_after(list, context) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/dtest/global.rb', line 15 def execute_after(list, context) begin exec(list, context) rescue StandardError, Exception => e # にぎりつぶす end end |
#execute_testcase(global_result, testcase) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/dtest/global.rb', line 55 def execute_testcase(global_result, testcase) begin # execute TestCases testcase.execute(global_result) rescue AbortTest, AbortTestCase => e # にぎりつぶす end end |
#start(testcases) ⇒ 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 48 49 50 51 52 53 |
# File 'lib/dtest/global.rb', line 23 def start(testcases) # Progress context = Context.new Progress.setUpGlobal(testcases) global_result = Test::GlobalResult.new(testcases) @before.each {|b| b.result = global_result.before_failure } @after.each {|b| b.result = global_result.after_failure } global_result.timer { begin # execute before exec(@before, context) # execute cases testcases.each do |testcase| execute_testcase(global_result, testcase) end rescue AbortGlobal => e # finish rescue StandardError, Exception => e # Blockでエラー処理しているので、にぎりつぶす ensure execute_after(@after, context) Progress.tearDownGlobal end } global_result end |