Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to output names of ruby unit tests

I have a unit test (example is modified Test::Unit documentation)

require 'test/unit'

class TC_MyTest < Test::Unit::TestCase
  def test_something
    assert(true)
  end
end

When I execute it, I get:

Loaded suite C:/test
Started
.
Finished in 0.0 seconds.

1 tests, 1 assertions, 0 failures, 0 errors

I would like to get something like this (test_something is outputted):

Loaded suite C:/test
Started
test_something
.
Finished in 0.0 seconds.

1 tests, 1 assertions, 0 failures, 0 errors
like image 446
Željko Filipin Avatar asked Jan 09 '09 09:01

Željko Filipin


2 Answers

If you're testing in rails you can use

rake test TESTOPTS=-v
like image 106
Scott Avatar answered Sep 20 '22 02:09

Scott


Run unit test with verbose option.

test.rb -v v

or

test.rb --verbose=verbose

Output:

Loaded suite C:/test
Started
test_something(TC_MyTest): .

Finished in 0.0 seconds.

1 tests, 1 assertions, 0 failures, 0 errors
like image 25
Željko Filipin Avatar answered Sep 21 '22 02:09

Željko Filipin