Yesterday my Rails class was reintroduced to rspec and testing. It’s been several weeks since we first dipped our toes into those waters… and quite frankly I haven’t missed it too much.
Apparently there is quite a bit of discussion around TDD these days. DHH (the guy who created Ruby on Rails) gave the keynote at Rails Conf this year and asked the question, “is TDD dead?”
Now, I don’t want to get into the whole “is test driven development dead” discussion. I would however like to talk a little bit about how I feel about testing in general and specifically with rspec.
We will start with how I feel about rspec right now and how I believe (hope, think) I will feel about it in a month.
Feelings are fickle things… They may change tomorrow.
How I really feel about TDD right now
Right now I kind of wish that TDD was dead. Of course I have very few reasons that make sense. However, the big reason that I wish TDD was dead is that I hate writing tests.
There. I said it. I really dislike writing tests.
I’ve been trying to write tests after writing the code that the tests are testing for the past 16 hours, it really isn’t much fun.
That really is about it right now. I know that I don’t love writing tests. In a lot of ways they seem counter intuitive. Why would I write tests when I can just know what my code does?
How I believe I will feel about TDD in a month
I do however see the value of testing and I hope to be able to experience and appreciate that value at some point.
If I write good tests and my app grows considerably (adding features as more and more people start using the app) I can make changes in my dev and test environments. Before pushing those changes to a live server I can run the tests and see if I broke anything. Often times one change can cause a bunch of other little things to break…
That is where I see tests being super helpful. Updating and changing code after the fact. Well written tests can keep me from pushing something live that makes me look like an idiot. (or that is flat out broken)
TDD may also be more awesome as I learn to write better tests. I enjoy watching people develop using it. They write the test, run rspec to make sure that the test says something is broken and then go write the code that reverses the “brokeness” that the test is looking for.
Basically you go step by step through a particular feature. Make one thing pass. Then make another piece pass… and before you know it you’ve got Facebook written on Rails. (not)
In Other News
I’m hoping to head home for the weekend. It will however be a really short trip as I won’t be able to leave here till Friday noon or so.
The trip itself looks rather tiring, but I do look forwards to seeing everyone again.
Have a great Thursday everyone.