I can't stop testing!

samtregar on 2004-10-16T16:25:31

I'm doing some work on a large body of code which lacks an automated test suite (MKDoc). My job at the moment isn't to add automated tests to the code, although I hope to take a crack at that in the near future. I figured I'd just wing it like I used to in the bad old days. How bad could it be?

However, I didn't realize just how strong my addiction to tests had become! After a few hours of coding I couldn't keep going. The code felt wrong. I couldn't see any problems but I knew they must be there. I hadn't proved the code worked, so why would it? I started getting paranoid and my code got more and more defensive. Clearly this wasn't going to work.

So I broke down, added a t/ directory with a single test file and started back into test-driven development. The newish prove command made this particularly easy since I didn't need to add a Makefile, just:

$ prove t

Ah, much better now!

-sam


prove!

WebDragon on 2004-10-16T17:21:05

somehow in all the press of things to study I somehow missed out reading about 'prove'. Thanks, I needed that! :D

Re:prove!

petdance on 2004-10-17T00:59:16

And here's the link to my slides about prove:

http://www.petdance.com/perl/use-prove-lt.pdf

Maybe I should distribute it with Test::Harness!

Same experience

cbrandtbuffalo on 2004-10-18T15:35:10

I had the same experience recently. I was working on a web app that we were told needed to be done very quickly. I figured I didn't have time for automated tests, so I was back to refreshing in the browser.

What a nightmare! After about half a day, I was back writing tests again and I finally got productive. It truly is a myth that automated tests take more time.

MKDoc?

perrin on 2004-10-18T15:48:05

What are you using it for? I can't quite tell what it offers by looking at the website. Are you doing something hat requires internationalized text?

Re:MKDoc?

samtregar on 2004-10-18T16:01:52

I'm actually doing development *on* MKDoc, rather than with it. They lost their lead developer a couple months ago and I answered the call.

As to what MKDoc offers, I'm not entirely up-to-speed. It's a dynamic application platform, which makes it a very different kind of content-management system than Krang or Bricolage. It supports a lot of front-end interactivity that's hard to do with a static publisher: personalization, forums, polls, search, etc. There's also a lot of emphasis on accessability and internationalization but I haven't gotten into that aspect much yet.

Internally it's an interesting system. The documentation is lacking and there are no automated tests, but the code is uniformly high-quality. I'm learning Petal as a result and I have to agree with your assessment, it's good stuff. Nothing I'd trust a typical web designer around, but a good tool for a programmer hacking HTML.

-sam