Remote test runner? (to avoid incurring the Rails startup for each test)

Hi all,

When I run a single test method, or single test class, I incur the penalty of loading the Rails environment. Running one test takes almost 23 seconds. Are there any plans to improve this, perhaps via a remote test runner? I think the Eclipse RDT Ruby dev plugin has something like this...see RemoteTestRunner.rb.

The basic idea is to run a DRb service which:

1. Requires the Rails environment on service startup
2. Redirects STDOUT and STDERR to capture them
3. Exposes a method to run a suite/test

We'd then need to be able to send the DRb message from IDEA, which would be done via an external tool in a pinch. Probably also a way to start/stop the service.

Thanks,

Brian

9 comments
Comment actions Permalink

Hi Brian,

We have Rake-Runner plugin for TeamCity buildserver see http://www.jetbrains.net/confluence/display/TW/Rake+Runner
It can automatically run Test::Unit and Spec tests. See Demo project "TeamCity Rake Runner Demo" at http://teamcity.jetbrains.com (you can login as Guest)
May be it will be useful for you.

P.S: Also I will look at RemoteTestRunner.rb.

0
Comment actions Permalink

Roman,

I worked on this yesterday and have a prototype working within IDEA 7.0. Basically, I have an external tool called 'Start remote test runner', which starts a DRb service that stays open as a 'Run' window within IDEA, just like a WEBrick server. This service loads the Rails environment and the test helper at startup. Next, I modified the ruby arguments in the 'Ruby Test' default configuration (under Run/Debug Configurations) so that it looks like:

-e "require 'drb';DRbObject.new_with_uri('druby://localhost:61677').run_test(ARGV[0],ARGV[2])"

This allows me to handle running a single test method, a single test file or all tests in a directory.

Speed is very good so far. I'm running tests in 0.5 seconds that used to take 13 seconds from IDEA due to the need to require the entire Rails environment even when running a single test method. I'll use it for a while, and if it looks promising I'll post the code on my blog and in here, if that's all right with you.

Thanks for a great tool!

Brian

0
Comment actions Permalink

Brian,

Good news! May be we can add support for this feature in Ruby plugin(fix configuration, bundle your script, etc)
Thanks =)

0
Comment actions Permalink

Roman,

Is there any way I can see the output filter that is used for processing the Test::Unit output when using IDEA's built-in 'Run' command for running a test?

Thanks,

Brian

0
Comment actions Permalink

Roman,

I'm getting quite close with this. One thing that I am having trouble with is the way IDEA behaves when you want to run all tests in a folder, i.e. if you right-click on the folder and then choose 'Run "All in :unit"'. I have written my script to accept a directory, and to gather up the tests in that directory and run them. However, IDEA appears to generate a temporary script that does almost the same thing. That is the file which is passed in as ARGV[0] to whatever script is defined in the configuration under the 'run' menu. Is there a way I can change this so that the folder is passed in, like the macros you use in external tools, e.g. "FileDir", etc.?

If not, I suppose I can scan that file for the FOLDER_PATH and use that. I tried simply running that file, and it behaved a little differently with regard to STDOUT and STDERR.

Thanks!

0
Comment actions Permalink

Brian,

Our run configurations doesn't support macros, and I'm not sure, than it is necessary. You can setup external tool for this and use $JDKPath$/bin/ruby as ruby interpreter.

I think the better solution - is to integrate your scripts into Ruby plugin and add ability to switch between your remote test runner scripts and standard way for running tests.

Edited by: Roman.Chernyatchik on Jun 12, 2008 3:15 PM

0
Comment actions Permalink

Resurrection this old thread, but 8 years later I'm hungry for Brian Hartin's solution and I don't see it implemented in IntelliJ IDEA. Don't know if this notifies Brian or Roman but wanted to make a ping for any updates.

0

Please sign in to leave a comment.