在测试/单位结果中显示消息

时间:2014-10-13 14:03:37

标签: ruby assertions testunit rescue

我想在测试通过后显示消息。我需要打印消息,以便我可以获得测试结果。

require 'test/unit'

class MyTest < Test::Unit::TestCase
  def sample
    begin
      count = 0
      5.times do 
        assert(true)
        count = count + 1
      end
    rescue
    ensure
    print "Total number of times: 5, Success count: 3 , Failures count: 2 "
    end
  end
end 

我希望得到像这样的东西

Loaded suite
Started
"Total number of times: 5, Success count: 3 , Failures count: 2 "
.
Finished in 0.0 seconds.

1 tests, 5 assertions, 0 failures, 0 errors

任何人都可以帮助我吗?

0 个答案:

没有答案