Graeme Moss
Graeme Moss

Reputation: 8433

Speed up slow unit testing for a rails app on Windows?

I'm looking for the quickest way to run unit tests for a rails app on a Windows machine, preferably automatically. My environment is:

Currently they run very slowly, eg. 30s to run a suite of 12 very simple unit tests, time mostly spent starting ruby it seems. The tests themselves take 5s to run according to autotest. For someone used to running 100s of tests in 10s, this is agony, and makes TDD infeasible. I'd even be happy if I could re-run one unit test in less than 5s...

I've searched other questions. Some are old and some conflict. What's the latest accepted wisdom on this? Here are the suggestions I'm aware of:

Getting a Linux box (or VMware) is out of the question at present, though getting more tempting...

Upvotes: 1

Views: 445

Answers (2)

Moiz Raja
Moiz Raja

Reputation: 5760

I write my tests using rspec and I have had great success making my tests run much faster with spork. The reasons tests rails tests run so slowly is because of the amount of time it takes to load rails and all the other gems that you use in your app.

If you can also upgrade to ruby 1.9.2 that would be quite useful.

Upvotes: 0

Dave Newton
Dave Newton

Reputation: 160261

You may want to look at something like spork (and a blog entry).

Upvotes: 1

Related Questions