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
About these ads
Categories: Ruby, Testing
  1. Kumaran
    12 September, 2007 at 3:23 pm | #1

    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 | #2

    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 | #3

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

  4. 17 April, 2008 at 1:42 am | #4

    Perfect was curious on how to properly test.

Comments are closed.
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: