How to Run Just one Test Method from your Terminal

zukunftsalick's picture

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 pathtoyourtestcase -n methodyouwanttotest

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

ruby test/functional/stuffcontrollertest.rb -n testshoulddostuff

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

Organization: ChristmasFuture Original: Source