Modifing TestRunner Help

U

uncleg

Hi all, being a ruby newbie I'm hoping someone could give me a heads up
on something I'm trying to put together.

I would like to be able to be able to run tests in my fixtures
individually if so desired. Hence if I had the follow file

#testFoo.rb

require 'test/unit'

class TC_Foo < Test::Unit::TestCase
def test_True
assert(true)
end
def test_False
assert(!false)
end
end

I could just type `ruby testFoo.rb` and have all the tests run but if I
only wanted a specific test to run I could type something like `ruby
testFoo.rb test_False`. Does anyone have any ideas/tips on how to go
about setting this up?

Ideas that come to mind are
- Creating a custom TestRunner
- Dynamically creating a new test case with all the methods of TC_Foo
minus the test_ that arent being tested.

Thanks
 
R

Ryan Leavengood

I could just type `ruby testFoo.rb` and have all the tests run but if I
only wanted a specific test to run I could type something like `ruby
testFoo.rb test_False`. Does anyone have any ideas/tips on how to go
about setting this up?

This works out of the box:

ruby testFoo.rb -n test_False

Pass --help to your test file to see all the options from the
Test::Unit test runner.

Ryan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top