Better software through debugging and unit testing -- Unit testing basics

Unit testing is critical part of the debugging process. These tips, tutorials and podcasts explain what unit testing is and how to effectively conduct them.

   Software debugging basics
   Unit testing basics
   Unit testing, Extreme Programming and TDD
   Debugging for security
   Other useful resources

  Unit testing basics

Unit testing is critical part of the debugging process. Still, it can be time-consuming and some developers and testers are put off by it. Alberto Savoia, unit testing expert and cheerleader, is featured in a number of the links below, and with good reason. Not only is he extremely knowledgeable, he knows how to sell unit testing. Reading these tips, tutorials and expert responses may not make you fall in love with unit testing, but they will teach you how to do it properly, effectively and efficiently.

  • Definition: Mock object -- Understanding mock objects is imperative, since they are so often employed in unit testing. This definition from should help.

  • Q&A: Unit testing critical for improving software quality -- Unit tester extraordinaire Alberto Savoia discusses why unit testing is so important and how he was inspired to write his hilarious booklet, The Way of Testivus... or How to Complete Projects Ahead of Schedule. The booklet may be entertaining, but it's also full of good testing advice.

  • Podcast: Unit testing in an agile environment -- Agile development involves a good amount of unit testing. In this Parasoft's Nada DaVeiga explains how agile software development affects unit testing in a software project.

  • Q&A: Alberto Savoia sings the praises of software testing, unit testing, specifically. Savoia explains why developers don't test their code nearly enough, whether "crappy code" is relative, and how developers can create code that's truly "beautiful." Read his chapter, "Beautiful Tests," from the book Beautiful Code for more.

  • Article: One programmer's unit test is another's integration test -- Kevlin Henney defines, for once an for all, what a unit test is by explaining what a unit test does. He's peppered his article with links that clarify his point further.

  • Article: Unit testing: Exploring the continuum of test doubles -- From MSDN Magazine, this intensive article goes beyond stubs and mock objects to include the full spectrum of what the author calls "test doubles." Readers are aided by several examples with code. MSDN includes a link the complete sample code.

  • Podcast: Painless unit testing for legacy Java code -- Those lucky enough to clean up legacy code may want to take a short break and listen to this podcast from Alberto Savoia. Savoia discusses a novel approach that may save time and stress.

  • Article: Issues in breaking dependencies for unit testing -- The author explores common stumbling blocks to unit testing legacy code and offers solutions. There's plenty of sample code to help the reader.

  • Blog post: Introduction to automated unit testing -- Jay Flowers has a lot of experience with unit testing and his post should be very helpful for those approaching automated unit testing for the first time. Sample code is provided.

  • Article: Top 12 reasons to write unit tests -- As if achieving software quality wasn't reason enough.

  • Blog post: Ajax and unit testing -- It's time to mingle -- In this helpful blog post about unit testing JavaScript, the author explains how to use the JSUnit tool, explains why unit testing is "freeing," and includes plenty of screenshots.

  • FAQ: Software testing FAQ:Unit test tools -- This thorough FAQ covers the tools, frameworks and libraries of unit testing. Highlights include Mockry and GrandTestAuto. This is a very large amount of information, and though it is well-organized, beginners may become overwhelmed.

For more information on unit testing tools and how certain methodologies affect unit testing, read our next section, Unit testing, Extreme programming and TDD.

Dig Deeper on Topics Archive

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.