Home > Ruby, Testing > Ruby unit testing – run only one test

Ruby unit testing – run only one test

5 December, 2006

If you don’t wish to run all the unit tests in your test case you can tell ruby to run only one by passing in the name of the test:

  ruby test_mytestcase.rb --name test_just_this_method
Advertisements
Categories: Ruby, Testing
  1. Kumaran
    12 September, 2007 at 3:23 pm

    Hello justin!

    I’m new to this testing in ruby, can u plz tell me how to apply more than one test case at a time.Plz explain me with an example.

  2. Matt
    18 September, 2007 at 5:41 pm

    Kumaran, you can do this by putting a –name (or -n) in front of each test name:

    ruby test_mytestcase.rb -n test_1 -n test_2

    Hope that helps,
    -Matt

  3. 15 November, 2007 at 6:07 am

    Note that each test must begin with the word test_xxx for it to run it.

  4. 17 April, 2008 at 1:42 am

    Perfect was curious on how to properly test.

  1. No trackbacks yet.
Comments are closed.
%d bloggers like this: