RSS

How to Run Just one Test Method from your Terminal

This entry was posted on Oct 01 2008

Many times I found myself running all tests just after modifying just one test method. Depending on the size of your project and its test ratio, it can be a very boring waiting for it to finish.

It can be even worse: Imagine you have other tests failing. How can you improve your productivity ?  Just use the “-n method_name” parameter for the method you want to test.

ruby path_to_your_test_case -n method_you_want_to_test

A real example, I want to test the “test_should_do_stuff” method inside my “stuff_controller_test.rb”:

ruby test/functional/stuff_controller_test.rb -n test_should_do_stuff

Worth remember that stills load your fixtures and preforms setup, it only won’t execute the other test methods.

Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Live
  • Slashdot
  • StumbleUpon
  • Technorati
  • description
  • LinkedIn
  • YahooMyWeb

Post a Comment