# How to run a specific TestUnit if the file contain two Test::Unit::TestCase classes?

**URL:** <https://www.ruby-forum.com/t/how-to-run-a-specific-testunit-if-the-file-contain-two-test-testcase-classes/179041>\
**Category:** Ruby\
**Created:** [November 16, 2009, 12:30pm UTC](https://www.ruby-forum.com/t/how-to-run-a-specific-testunit-if-the-file-contain-two-test-testcase-classes/179041 "2009-11-16T12:30:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [November 16, 2009, 12:30pm UTC](https://www.ruby-forum.com/t/how-to-run-a-specific-testunit-if-the-file-contain-two-test-testcase-classes/179041/1 "2009-11-16T12:30:30Z")

</div>

Hi, I’ve a file with two classes:

class Test1 \< Test::Unit::TestCase  
def test\_aaa  
…  
end  
end

class Test2 \< Test::Unit::TestCase  
def test\_aaa  
…  
end  
end

How could I run just the “test\_aaa” of the Test1 class?  
If I run:  
./my\_tests.rb --name test\_aaa  
then just the latest function is runned.

Thanks.

---

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [November 16, 2009, 12:34pm UTC](https://www.ruby-forum.com/t/how-to-run-a-specific-testunit-if-the-file-contain-two-test-testcase-classes/179041/2 "2009-11-16T12:34:00Z")

</div>

El Lunes, 16 de Noviembre de 2009, IÃ±aki Baz C. escribiÃ³:

> ```
> ...
> end
> 
> ```
> 
> end
> 
> How could I run just the “test\_aaa” of the Test1 class?  
> If I run:  
> ./my\_tests.rb --name test\_aaa  
> then just the latest function is runned.

Sorry, the fact is that both functions are runned.

---

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [November 17, 2009, 10:57am UTC](https://www.ruby-forum.com/t/how-to-run-a-specific-testunit-if-the-file-contain-two-test-testcase-classes/179041/3 "2009-11-17T10:57:17Z")

</div>

I also encounter this kind of problem. It seems that Ruby does support  
sort  
of meta-data applied to methods like attributes applied to methods in  
.NET,  
which allows us to distinguish two methods in our judge.

allenlooplee
