# Running Rails Tests in Eclipse Test::Unit GUI

**URL:** <https://www.ruby-forum.com/t/running-rails-tests-in-eclipse-test-unit-gui/98839>\
**Category:** Rails\
**Created:** [January 30, 2006, 3:14pm UTC](https://www.ruby-forum.com/t/running-rails-tests-in-eclipse-test-unit-gui/98839 "2006-01-30T15:14:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghoti143](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@ghoti143](https://www.ruby-forum.com/u/ghoti143)\
**Post date:** [January 30, 2006, 3:14pm UTC](https://www.ruby-forum.com/t/running-rails-tests-in-eclipse-test-unit-gui/98839/1 "2006-01-30T15:14:32Z")

</div>

Maybe this is common knowledge, I don’t know. I figured I’d post it,  
hopefully it can help some people. If anyone has a better way, please  
share.

[jrhicks.net](http://jrhicks.net/120) (not my blog, I’m Mike in the comments

I couldn’t get it to literally run the test in the identical way as  
rails does when you type rake. However, I could get it to run an  
individual test file in the GUI, by opening the file and picking Run As  
Test::Unit Test off the menu. From there, I figured why fight to do it  
the “elegant” way when I can just create a new file that requires all my  
test files. There’s no reason one couldn’t get it identical to the “rake  
way,” but I didn’t feel like fighting any more.

I made a new file in the test directory, I called it all\_tests.rb but  
you can call it whatever you want. The contents is (one line):

[“unit”,“functional”].each { |t| Dir.foreach(“test/#{t}”) { |f| require  
“test/#{t}/#{f}” if f =~ /.\*.rb/} }

There’s no need for it to be a one-liner, I made it that way cause …  
well cause of the same reason anyone makes an unnecessary one liner, for  
fun. That will call “require” on each one of your test files. If you  
have additional directories other than unit and functional with test  
files, just add them in the array.

Run that file with Run As/Test::Unit Test and it should run all your  
tests in the GUI. I remapped Run As Test::Unit Test to Ctrl-T in my  
environment, just for convienence, so it’s open that file/Ctrl-T.  
Obviously that’s optional.

It’s not QUITE as convienent as the ideal (a keystroke AND A MOUSE  
CLICK?!?!?!?!?!?!?!?!?!) but it’s pretty darn good.

---

<div class="post-metadata">

**Author:** ![ghoti143](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@ghoti143](https://www.ruby-forum.com/u/ghoti143)\
**Post date:** [January 30, 2006, 3:48pm UTC](https://www.ruby-forum.com/t/running-rails-tests-in-eclipse-test-unit-gui/98839/2 "2006-01-30T15:48:57Z")

</div>

Hey Mike,

thanks for sharing this. I’ve just tried it. Works great!

Regards  
Jan P.
