DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Unit Testing - Do you do it? If so, how?  (Read 5,016 times)

mnemonic

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 177
    • Programming School - Stage 1 Medal
    • Programming School - Deluxe Bonus Medal
    • Participated in NANY Challenge Once
Unit Testing - Do you do it? If so, how?
« on: April 11, 2009, 04:03 PM »
I'm a "gradually improving" newbie developer and currently have a fairly blasé and ad-hoc approach to testing.  Having done a bit of reading, it seems that the next thing to learn is unit testing.  However, although I get the principle (ensuring that code changes don't break the overall code), I don't really understand how unit testing is done - especially around unit testing frameworks.

If you're writing your own applications at home, do you use unit testing?  If so, how do you do it?  Is this just a list of tests and values to use in those tests, or do you employ a more automated method?  (Any references to how to do this in python will be given extra points).

Thanks.

tinjaw

  • I'm so glad breakbeat techno isn't an illegal drug
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • Participated in NANY Challenge Twice
    • Coding Snacks
    • Military Service Badge - US Army
    • Linux User
Re: Unit Testing - Do you do it? If so, how?
« Reply #1 on: April 12, 2009, 08:27 PM »
I want to do TDD on every project, but I am not there yet. I am a Python coder so I can tell you that TDD is very easy in Python and it is almost universally practiced by the major coders and projects.

The best list of testing tools for Python is at:
http://pycheesecake.org/wiki/PythonTestingToolsTaxonomy

I use nose and find it easy to use.

Hmm, what to suggest for getting started is tough to say. If you are willing to lay out some money, I would suggest the book Expert Python Programming. It is an excellent book and has some good introductory information on unit testing in Python.

Dive Into Python has a good chapter on Unit Testing.

I haven't read this, but it looks like a good introduction.

mnemonic

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 177
    • Programming School - Stage 1 Medal
    • Programming School - Deluxe Bonus Medal
    • Participated in NANY Challenge Once
Re: Unit Testing - Do you do it? If so, how?
« Reply #2 on: April 12, 2009, 09:05 PM »
Fantastic, thanks Tinjaw.  I'll start to work through the links.

I've also found the following general introduction to unit testing, which I'm currently working through:

Testing 101

Original address: https://www.donationcoder.com/forum/index.php?topic=17870.0