Posts Tagged ‘JUnit’

Making Maven 2 work with JUnit 4

The current stable version (2.2) of the maven-surefire-plugin does not support JUnit 4. So Maven, out of the box, does not work with JUnit 4. Luckily if we want to use JUnit 4 in our Maven based projects we have two choices. The first is to use JUnit4TestAdapter as illustrated in this post. The second [...]

Book Review: Pragmatic Unit Testing

Pragmatic Unit Testing is an easy to read introduction to unit testing. This book covers the basic information you need to know in order to effectively write unit tests. This book covers in less than 200 pages: What is unit testing and why developers must unit test every piece of code they write. An introduction [...]

Refactoring from Template Method to Strategy can reduce code duplication in unit tests

Ivan Moore has a great post “Replacing Inheritance with Composition” at his blog, that explains how when you refactor your code from using Template Method to using Strategy can reduce the code duplication in your unit tests and also make your tests simpler. Both patterns, template method and strategy, try to solve the same problem. [...]

TDD and mock objects

If you are new to TDD and to mock objects (like me) you may want to read the paper “Mocks Aren’t Stubs” written by Martin Fowler. In this article Fowler talks about the two testing paradigms, state based and interaction based. I will use TDD, for the first time, in my next project and I [...]