Would you ever stop changing the oil on your car? I wouldn’t. It’s part of the maintenance that leads to a longer life span for my car and ensures it runs smoothly. In fact, because the automobile industry has done such a good job of educating consumers about the need to change oil, people still change it more frequently than necessary even when their owner’s manuals tell them they don’t need to.
Alas, if only the software industry had done as a good job on educating consumers about the maintenance benefits of software testing.
What are software tests?
In the context of Ruby on Rails software, tests typically refer to special code that is written to test whether or not your software is behaving in an expected fashion.
Why do you want them?
There are 3 good reasons
Automation & Time Savings
In a rails application, a suite of tests can be run automatically. You don’t have to spend time clicking in a browser testing various parts of your web application. Needless to say, this can save both you and your developer a lot of time.
Makes It Harder to Introduce Bugs
Because of the automation testing introduces, whenever you introduce a new feature, you can automatically check if any part of your system “broke” due to the way your feature was coded.
Makes It Easier to Transition the Project to Another Developer
A lot of times when I’m coming on to an existing application, it can be helpful to read the tests. This is because the tests tell you what the system is supposed to do. If you’re a client wanting a Rails application worked on, a well-written test suite can help a new developer on your project get up to speed a bit quicker. Needless to say, this can translate into lower costs over the entire maintenance life cycle of the project.
When do you not want them?
The only time you may not want a test suite for your application is if it’s a toy application and the only users are you and your grandmother. Seriously, other than that, you’ll probably always want tests.
But your developer is charging an hourly rate, so won’t testing cost more?
Initially, there will be a higher upfront cost. But you get all the aforementioned benefits. It’s sort of the same reason why people keep changing their oil. They don’t want to do it, but they know the price of not changing it in the long run is much higher than the upfront cost of doing it every 5000 miles. Like oil changes for your car, in the long run, software testing can make your application and its development run much more smoothly.