speed up tests
Ticket
+issues
When I've been doing code katas with folks in Chicago, it makes doing TDD in Wagn feel like swimming in molasses.
Running a scenario under spork on a new rails project takes just under 3 seconds. On Wagn, it's closer to 7 for startup plus each step typically takes a second or two, so we often have 20+ second round-trips for a single scenario.
Additionally, our total test suite ( test:unit + rspec + cucumber ) takes a grand total of about 20 minutes. This is *waay* too long. A quick benmark suggests that up to 80% of the time in the unit tests occurs in Card#save.
Jon Dahl (some rails developer with a blog :) says:
Most Rails projects I’ve worked on have ended up at around 3,000-15,000 lines of code, with a roughly as many lines of test code, and most have test suites that take a minute or more to run. Our test suite for Tumblon, for instance, churns along for 2.5 minutes. This is a too slow. And slow tests are a problem for at least two reasons: they slow down your development and decrease code quality
This is only one datapoint but we're an order of magnitude out of his target.
+solution
In no particular order:
- fixture import (aka test db reset) only on request instead of every run (should save 1-3s? every run)
- review all tests for card setup that can be moved to the global fixture set
- optimize Card#save (this is valuable for other reasons as well, obviously)
- spot optimize slowest tests.