# Run a single test with Test::Unit?

**URL:** <https://www.ruby-forum.com/t/run-a-single-test-with-test-unit/165804>\
**Category:** Rails\
**Created:** [April 17, 2009, 5:53pm UTC](https://www.ruby-forum.com/t/run-a-single-test-with-test-unit/165804 "2009-04-17T17:53:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [April 17, 2009, 5:53pm UTC](https://www.ruby-forum.com/t/run-a-single-test-with-test-unit/165804/1 "2009-04-17T17:53:12Z")

</div>

Hi,

I have tests written as:

test “some test” do  
…  
end

But when I want to run a single test it doesn’t work like before:

$ ruby test/functional/some\_controller\_test.rb -n some\_test

Iget 0 test, 0 assertions…

I also rewrote the test to :

def some\_test  
…  
end

And still no luck. Has anything changed from the various tutorials found  
on the internet? Also [guides.rubyonrails.org](http://guides.rubyonrails.org) has nothing about that.

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [April 17, 2009, 7:02pm UTC](https://www.ruby-forum.com/t/run-a-single-test-with-test-unit/165804/2 "2009-04-17T19:02:30Z")

</div>

On 17 Apr 2009, at 16:53, Fernando P. wrote:

> But when I want to run a single test it doesn’t work like before:
> 
> $ ruby test/functional/some\_controller\_test.rb -n some\_test
> 
> Iget 0 test, 0 assertions…
> 
> I also rewrote the test to :
> 
> def some\_test  
> …  
> end

test method names have to start with test (ie test\_some\_test ) which  
is what the block for of test does.  
ruby … -n test\_some\_test should do the trick

Fred
