On Sep 4, 2006, at 9:25 PM, Phlip wrote:

> Rubies:
>
> Here's a normal example of running a Ruby/Unit suite:
>
>     aTestSuite = Test::Unit::TestSuite.new("MRW")
>     aTestSuite << a bunch of suites
>     got = runner.run(aTestSuite)
>
> The above code runs all test cases. I want to run only one of them.
>
> A "test suite" is (generally) a list of test cases. Here, it is a  
> list of
> lists of test cases. Running only one *.rb file would run all cases  
> in that
> file's suites. I want to run only one test case. Here are three  
> test cases:
>
> class SomeSuite < Test::Unit::TestCase
>
>     def test_runThisCase()
>        #...
>     end
>
>
>     def test_dontRunThis()
>        #...
>     end
>
>     def test_orThis()
>        #...
>     end
>
> end
>
> Running SomeSuite is trivial.
>
Now I see your problem.

  def test_blah
  end

is NOT a test case as far as the established terminology is  
concerned. It is a test.

class A < Test::Unit::TestCase
    def test_one
    end

    def test_two
    end

    def test_three
    end
end

is a test case. (hence it's inheritance from TestCase), a test case  
being a collection of tests.

A test suite is a collection of test cases. Usually a test suite is  
defined as a single file ts_something.rb containing

require 'tc_one'
require 'tc_two'
require 'tc_etc'

where tc_one.rb, tc_two.rb, etc. each contain one test case. (one  
class that inherits from Test::Unit::TestCase). You're problem was  
that you were asking the wrong question. You didn't  want to know how  
to run an individual test case, you wanted to know how to run an  
individual _test_. Unfortunately, I do not know how to do that, short  
of having one test per test case, and having one test case per file.


>
> -- 
>   Phlip
>   http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
>
>
>