BDD and TDD - What are they for?

D

David Masover

Right. The bigger the project, the longer it runs, the more you need tests.

Well, more than that, my point was that the longer you wait, the harder it's
going to be to write those tests.

Doing tests early on forces you to make things testable. It forces you to
break your program down into somewhat-isolated units.

I had a graphic example of this -- I was downloading an HTML document from a
site (with Open-URI) and then parsing it (with Hpricot). How do I test that?
I suppose I could leave it as-is, but then I'm assuming the site in question
is always up. I'm not testing the site, I'm testing my code.

So the solution was to refactor -- split the parsing from the downloading, and
provide a convenience wrapper that does both.

But you see -- refactoring is exactly what testing is supposed to make easier.
Wait too long, and you have a catch 22 -- you have to refactor to test
effectively, but you need tests to refactor effectively. So either way you
go, you're going to be somewhat ineffective.

And the longer you wait, the worse it's going to get.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top