# Run all tests

**URL:** <https://www.ruby-forum.com/t/run-all-tests/95817>\
**Category:** Ruby\
**Created:** [June 14, 2006, 5:49pm UTC](https://www.ruby-forum.com/t/run-all-tests/95817 "2006-06-14T17:49:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/97f17d/32.png) [@brian](https://www.ruby-forum.com/u/brian)\
**Post date:** [June 14, 2006, 5:49pm UTC](https://www.ruby-forum.com/t/run-all-tests/95817/1 "2006-06-14T17:49:31Z")

</div>

Hello all,

In learning ruby I’ve created a ton of rb files.

Organizationally my files are a mess. Some of my files contain only  
tests,  
some have tests and code, and some have code with tests wrapped with an  
if  
**FILE** == $0 … end guard . Some files require other rb files and  
the  
files are scattered over a handful of directories.

Is there a good way to run all my tests at once?

–Brian

---

<div class="post-metadata">

**Author:** ![brian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/97f17d/32.png) [@brian](https://www.ruby-forum.com/u/brian)\
**Post date:** [June 14, 2006, 6:01pm UTC](https://www.ruby-forum.com/t/run-all-tests/95817/2 "2006-06-14T18:01:48Z")

</div>

On 6/14/06, Brian B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello all,
> 
> In learning ruby I’ve created a ton of rb files.
> 
> Organizationally my files are a mess. Some of my files contain only tests,  
> some have tests and code, and some have code with tests wrapped with an if  
> **FILE** == $0 … end guard . Some files require other rb files and the  
> files are scattered over a handful of directories.
> 
> Is there a good way to run all my tests at once?

I recommend changing all your test code to use Test::Unit.

If you

1. name all those source files following the convention test\_\*.rb
2. put the code being tested in a directory named lib
3. put the test code in a sibling directory named test

then you can run all your tests from the lib directory with  
testrb …/test
