News for hackers. Stuff that matters.
Re:30K application lines + 110K testing lines: Evidence of...? by bk on Monday April 14, 2008 @09:36AM (#163108)
Short version:

Logic errors are much trickier than type errors, so I focus tests on parts with tricky logic.

Long version:

I really like the BDD approach of thinking about tests as executable specs. Before I write any code, I need to think through how exactly I want my code to behave. While I'm doing this, I might as well capture it in a list of (empty) specs, so that I and others have a clear and concise summary of the code's declared behavior.

A lot of web app code is fairly trivial / non-mission-critical, so I don't spend too much time testing it. Instead I focus my effort on the parts where it really matters (e.g. a permissions system that could expose private user information or lead to data loss if a bad code tweak goes unnoticed).

Some things I couldn't imagine writing without tests. Right now, I'm building a somewhat complex grammar using a parser generator library, and the only way to stay sane in this process is by building a test suite that alerts me whenever a subtle logic mistake in one of my rules breaks something somewhere else.

There are no comments on this comment yet.