Geeks With Blogs
Patrice Calve Life's short, have fun
God I love writing Unit Tests.

I either find bugs in code, bugs in my unit tests (darn cut and pastes), or bugs in my head.  Let me explain in a second.

I like TDD.  I also like, TAD (Test After Development) or the one I use the most these days: TASAYC (Test As Soon As You Can)

The benefit of using TASAYC, is that you're creating unit tests about code you haven't touched in quite a while.  You either write the wrong unit tests because of "bugs in my head", the wrong unit tests because of assumptions of the ways the actual code is suppose to work (mix of "bugs in my head" + "bugs in code"), or you write the right unit tests and actually find bugs in the code!

Use TDD for those "normal test case testing".  ie: you write 1 or 2 "normal" unit tests for what your working on (procedure/function) and move on to the other areas of your application.   You end up with a "working application" quickly, and you have a "base" for unit testing (thus regression testing).

Before you "close" that class/form/app.  Go back to your unit test project and cram in those extra or "abnormal unit tests".  The extra unit tests are those that you know you should be testing but didn't have time and needed to fork out an application ASAP.  The "abnormal unit tests" are those where you to test the handling of improper inputs (overflows, etc.)

Remember, when you develop, the goal is the end product; ie: an application that others use, including QA/Testers.  Give them something to play with as soon as possible, then, while they are playing that application, improve the code by performing various methodologies:
  • Improve the Unit Testing
  • Scenario/Use Cases (actually testing of the app in a real life scenario)
  • Code Reviews

So,
  • No unit test = shame on you.
  • TDD = that's great, but don't get caught in writing more unit tests than applications!
  • Any other unit test methodology = That's great too!
  • A mix of both TDD + AnyOtherTestingMethodology = yeah baby.

Have fun, life's short!

Pat Posted on Monday, February 11, 2008 4:07 PM | Back to top


Comments on this post: Unit Testing = good

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Patrice Calvé | Powered by: GeeksWithBlogs.net