Unit-Testing: The Martinizer

I. Introduction & Philosophy The “Martinizer” is a little tool I’ve created to help improve unit-test coverage on large Java projects.  The name is a tip-of-the-hat to “Uncle Bob” Martin of TDD fame, with a little word-play on “One hour Martinizing”, a dry-cleaning service.  (DRY, as in Don’t Repeat Yourself — get it?) The tool … Continue reading “Unit-Testing: The Martinizer”

Unit-Testing Tutorial 03: Dummies and Mocks

I. Introduction  —  What’s a dummy?  What’s a Mock? When we write a unit-test for a method, we’re primarily interested in that method.  Ideally, we’re not testing other objects or methods used by that method. (Apply a liberal helping of common sense, however.  If method X uses methods Y and Z in the same class, … Continue reading “Unit-Testing Tutorial 03: Dummies and Mocks”

Unit-Testing Tutorial 02: “Test Driven Development”

I. Introduction “Test Driven Development” (TDD) is a discipline for writing code by writing the unit-tests first.  More precisely, it is a cycle of: Write a (failing!) test Write just enough code to pass the test. Refactor the code to keep it clean (but still passing) where, at each iteration, you build up the “production” … Continue reading “Unit-Testing Tutorial 02: “Test Driven Development””

Unit-Testing Tutorial 01: Introduction

I. Introduction and Purpose This series of blog posts is an adaptation of a set of classes on unit-testing that I teach at ProQuest (a leading academic and corporate search engine for ‘paywalled’ articles and data).  ProQuest has been kind enough to allow me to publish this series for anyone to read and learn from. This … Continue reading “Unit-Testing Tutorial 01: Introduction”

The Junit Green Lantern Oath

In brightest day, in blackest night No failing tests shall escape my sight! Let those who sloppy code would write Beware my power — Junit’s green light! OK, it’s kitsch.  Tacky.  Geeky.  Even (shudder) cute.  But it also has a point.  Bear with me.  (I’m assuming you’re a software developer, and already familiar with unit-testing, … Continue reading “The Junit Green Lantern Oath”