Category Archives: Testing

Building Unit Test Data

In the book Growing Object-Oriented Software, Guided by Tests, authors Steve Freeman and Nat Pryce suggest a neat pattern for cleanly creating test data for unit tests. They suggest using the builder pattern to build test objects which are as simple or as complicated as necessary for the test. The builder can set default data in fields meaning that only data significant to the result of the test needs to be set.


ZeroTurnaround, the smart kids behind JRebel, have launched a new product: XRebel. And boy, it’s a good one! It’s described as “X-Ray glasses for your webapp”. It’s a performance profiler with features previously only seen in serious application performance monitoring (APM) solutions such as AppDynamics and New Relic.

Testing for SimpleDateFormat thread safety

Declaring an instance of SimpleDateFormat as a constant (static final class member) is usually bad. But then again, it’s a very obvious thing to do.

MockMVC to test Spring MVC form validation

The MockMVC class allows tests to be run against a real Spring application context without actually having to run the complete application in a Servlet container

Coding in the Age of Distraction

I’ve started adopting Test Driven Development (TDD) practices over the last year or so and discovered an unexpected benefit: failing tests are a great placeholder for your thoughts when you get distracted.

Integration Tests with Selenium and tomcat7-maven-plugin

To create an automated integration test of my spanners-struts webapp, I need a way of launching it as part of the Maven build process.

Protecting Service Methods with Spring Security Annotations

Any class or method can be protected with Spring Security using either AOP interceptors or expression based annotations on the class or method.

DbUnit and Jailer

Jailer will export data from a single table and all data that is related to it by foreign key references. This can result in far more data being scripted than expected.

Just tell me what broke!

If I know that there’s a problem with one of my services, I don’t want a heap dump of my whole application nor do I want to guess what class may be causing the issue. I want something that just tells me what broke.

Web service testing with soapUI

soapUI is an essential free tool for testing SOAP and other web service protocols. It was particularly useful for testing the SpannersWS demo as it works well with WSS.