Class: Testowl::TestUnitRunner
- Inherits:
-
Object
- Object
- Testowl::TestUnitRunner
- Defined in:
- lib/testowl/test_unit_runner.rb
Instance Method Summary collapse
Instance Method Details
#run(files) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/testowl/test_unit_runner.rb', line 13 def run(files) results = begin runDrb(files) rescue puts "Drb not available. Running tests directly instead." runDirectly(files) end puts "Done" count_match = /(\d+)\sassertions?,\s(\d+)\sfailures?,\s(\d+)\serrors?/.match(results) timing_match = /Finished\sin\s([0-9\.]*)\sseconds/.match(results) puts count_match puts timing_match if count_match && timing_match test_count = count_match[1].to_i fail_count = count_match[2].to_i + count_match[3].to_i # let's lump errors and failures together timing = timing_match[1].to_f return test_count, fail_count, timing else raise "Problem interpreting result. Please check the terminal output." end end |
#runDirectly(files) ⇒ Object
43 44 45 46 47 |
# File 'lib/testowl/test_unit_runner.rb', line 43 def runDirectly(files) results = TestOwl::Teeio.new results.run "ruby #{files.join(' ')}" results.output end |
#runDrb(files) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/testowl/test_unit_runner.rb', line 35 def runDrb(files) DRb.start_service("druby://127.0.0.1:0") # this allows Ruby to do some magical stuff so you can pass an output stream over DRb. test_server = DRbObject.new_with_uri("druby://127.0.0.1:8988") results = TestOwl::Teeio.new test_server.run(files, results, results) results.output end |