Topic: Using Autotest with Rails on Windows XP machines

This is a short tutorial on how to use autotest on a Windows XP device. The great thing about autotest is that it updates your test results automatically each time you make changes to your models, controllers or test files. Here's how to do it.

First, install ZenTest

gem install ZenTest

Then go to the directory of your rails application. For example:

cd c:\rails\myrailsapp

Next, before you start autotest, you should always set the env variable. At least on Windows. You do it like so

set HOME = C:\Documents and Settings\username

Note that username is your name on your machine. It could be daibatzu or john, lisa, mark whatever. So for john it would be "set HOME = C:\Documents and Settings\john". If you are in doubt, just click on the start button and you should see the name of the current user at the very top of the start menu next to your avatar when logged in.

After this, assuming you are still in the directory of your rails app, simply type the command.

autotest --rails

And voila, autotesting is enabled. This is actually a very cool tool as you will soon find out. Simply begin writing tests for your rails applications and see what happens.

Re: Using Autotest with Rails on Windows XP machines

I just want to mention that to get the env variable to work, I added it in My Computer>Properties and then had to restart my computer.
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/92dee677aa1b3c01/5e12d1312f25b1fe?lnk=gst&q=couldn't+find+HOME+environment

Re: Using Autotest with Rails on Windows XP machines

Actually, you also need diff.exe in your path.
See my rant and tutorial here: http://rookieonrails.blogspot.com/2007/ … ndows.html

Re: Using Autotest with Rails on Windows XP machines

Has anyone seen this error on windows?

c:/ruby/bin/unit_diff:19: invalid name for global variable - -u; (NameError)

Re: Using Autotest with Rails on Windows XP machines

I needed to delete --colour in the spec.opts to make it actually work.

Re: Using Autotest with Rails on Windows XP machines

I was getting the following error after following this:

C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:377:in `report_activate_error': RubyGem version error: hoe(1.3.0 not >= 1.4.0) (Gem::LoadError)
        from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:309:in `activate'
        from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:335:in `activate'
        from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:334:in `each'
        from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:334:in `activate'
        from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:76:in `active_gem_with_options'
        from C:/Program Files/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:50:in `gem'
        from C:/Program Files/ruby/bin/autotest:18

Turns out I had to run a "gem update --include-dependencies" before this would work for me.

Re: Using Autotest with Rails on Windows XP machines

daibatzu wrote:

This is a short tutorial on how to use autotest on a Windows XP device. The great thing about autotest is that it updates your test results automatically each time you make changes to your models, controllers or test files. Here's how to do it.

First, install ZenTest

gem install ZenTest

Then go to the directory of your rails application. For example:

cd c:\rails\myrailsapp

Next, before you start autotest, you should always set the env variable. At least on Windows. You do it like so

set HOME = C:\Documents and Settings\username

Note that username is your name on your machine. It could be daibatzu or john, lisa, mark whatever. So for john it would be "set HOME = C:\Documents and Settings\john". If you are in doubt, just click on the start button and you should see the name of the current user at the very top of the start menu next to your avatar when logged in.

After this, assuming you are still in the directory of your rails app, simply type the command.

autotest --rails

And voila, autotesting is enabled. This is actually a very cool tool as you will soon find out. Simply begin writing tests for your rails applications and see what happens.

Thanks a lot.

http://www.soft-windows.com/

Re: Using Autotest with Rails on Windows XP machines

Use autospec to launch the automatic testing suite instead of autotest --rails

Re: Using Autotest with Rails on Windows XP machines

While following your instructions, i got an internal error occurred during: "Launching myRailsApp". Any suggestions?

Last edited by gregorv (2012-05-11 02:26:31)