Unit testing

I just committed basic unit testing support to Renquist, implemented using Python's unittest framework. The results were quite pleasing. Now I can quickly run multiple automated tests to ensure correct behavior and avoid regressions! Huzzah!

For my first two tests I decided to try using a blank file as both a Feed and as a List. The blank Feed test uncovered a bug I hadn't considered, while the blank List test made me fix a problem I had already tagged as a failure point in the comments of the source code. Both bugs are fixed now, but there's surely still a lot of code that isn't being touched by these tests. But how can I identify those untested lines of code?

The first thing I thought after writing those two test cases was, There should be a way to visually identify the untested code. After looking through the Python documentation, the first thing I found was the "trace" module, which can output every single line that gets run. It would take almost no work at all to generate a very simple HTML file, highlighting tested code (or untested code).

Before I write that software, though, I'm going to search a little online. I can't imagine that someone else hasn't had that idea, too.

Here's to automated testing!

5 comments:

Anonymous said...

Three cheers, etc.

Herohtar said...

Don't die of shock, but I just posted on my blog. (Just in case my feed had been removed due to inactivity... <.<)

Anonymous said...

Of course I still follow your feed! It's a bunch of /other/ feeds I've ditched...

Herohtar said...

Since you don't have Facebook I guess I will have to post my meaningless message here instead. :P

Happy birthday!

Anonymous said...

You're posting a birthday comment to my equivalent of a wall?! It's all just so dreary and banal!

Meaningless! Meaningless!

...and thanks for remembering my birthday!