Peter Marklund

Peter Marklund's Home

Fri August 31, 2007
Programming

Rails Testing: Switching from Test::Unit to RSpec, What are the Advantages?

It's been a couple of months now since I switched from Rails built in Test::Unit framework to using RSpec and I've realized that RSpec has already brought some major advantages for me. Just to clarify, I still run all my old Test::Unit tests and I still write Test::Unit integration tests to complement my specs. The Rails testing framework and RSpec can run nicely side by side through the rake command. Here is what RSpec has given me:

Another realization that has come to me lately, is that yes, regardless of what code you are writing TDD/BDD is a good idea. However, if you are writing any kind of API or framework that is to be reused across several applications, tests/specs and well defined interfaces are almost a necessity. If you don't have them, you might be better off opting for no reuse. Reuse is the holy grail of software development, and it's hard.

Comments

JoNtE said over 6 years ago:

Hi Peter.

Just purchased the two Peepcode movies about RSpec.
Have to improve my TDD-skills.

Good post, specifically interesting is the "customer acceptance" part.

C YA
// JoNtE

--------------------------------------------------------------------------------