Class: DTR::Agent::TestCase
Instance Method Summary collapse
- #add_error(e) ⇒ Object
-
#initialize(test, result, &progress_block) ⇒ TestCase
constructor
A new instance of TestCase.
- #run ⇒ Object
- #unexpected_error(e) ⇒ Object
Constructor Details
#initialize(test, result, &progress_block) ⇒ TestCase
Returns a new instance of TestCase.
20 21 22 23 24 |
# File 'lib/dtr/agent/test_case.rb', line 20 def initialize(test, result, &progress_block) @test = test @result = result @progress_block = progress_block end |
Instance Method Details
#add_error(e) ⇒ Object
46 47 48 49 50 |
# File 'lib/dtr/agent/test_case.rb', line 46 def add_error(e) @result.add_error(Test::Unit::Error.new(@test.name, RemoteError.new(e))) @result.add_run @progress_block.call(Test::Unit::TestCase::FINISHED, @test.name) end |
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dtr/agent/test_case.rb', line 26 def run if @test.is_a?(DRb::DRbUnknown) add_error(UnknownTestError.new("No such test loaded: #{@test.name}")) else @test.run(@result, &@progress_block) end rescue DRb::DRbConnError => e msg = "Rescued DRb::DRbConnError(#{e.}), while running test: #{test}. The master process may be stopped." DTR.do_println(msg) DTR.info {msg} rescue Exception => e unexpected_error(e) end |