By Martin Harris on May 17th, 2010
I wanted to explore the possibility of using JBehave to formalise scrums definition of done. The idea being to encapsulate a definition of done as a JBehave scenario. So in true scrum style I decided to timebox 4 hours of work dedicated to JBehave.
From a scrum point of view BDD can be used to turn the definition of done into a test artifact. The team produces scenarios for each task. With JBehave a scenario file describes the required behavior and test steps it will need to pass to be considered done. I.e Given some prerequisites, perform some action and expect some results. See the JBehave project for more detail as this is only a simple example. Continue reading Bad or Good? Behavior Driven Development within Scrum. →
By Martin Harris on April 27th, 2010
Sometime back I wrote about some testing anti-patterns. Recently I came back to the project and made some trivial changes. I fixed a bug upgraded spring and junit and migrated the test assertions to hamcrest fluid style. The full project is available on git.
I find hamcrest to be a much cleaner way of writing assertions. This test demonstrates the use of its fluid interface with some simple collection assertions. There are newer versions of Hamcrest and the collection package may have moved into core, but the version I use here (1.0) was available on maven. Note the integration with Junit. The hasItem and hasItems methods are sourced from Junit 4.8.1.
package org.testpatterns.hamcrestexamples;
import java.util.Arrays;
import org.junit.Test;
import static org.hamcrest.collection.IsArrayContaining.hasItemInArray;
import static org.junit.matchers.JUnitMatchers.*;
import static org.junit.Assert.assertThat;
public class CollectionExamples {
//Hamcrest with Collections and Arrays:
static final String[] array = { "A", "B", "C" };
static final List<String> list = Arrays.asList(array);
@Test
public void oneThingInArray () {
assertThat(array, hasItemInArray("A"));
}
@Test
public void arrayOfItemsInList () {
String[] expected = { "A", "B", "C" };
assertThat(list, hasItems(expected));
}
@Test
public void itemInAList () {
assertThat(list, hasItem("A"));
}
@Test
public void itemsInAList () {
assertThat(list, hasItems("A", "C"));
}
}
By Martin Harris on April 7th, 2010

Cuban Car: Martin Harris
Well perhaps not Nirvana then, but at least having a suitable level of test coverage.
I wanted to write an article around the uptake of test driven development. Scrum and agile are hard to do well. If you break these down, you often find that the components are pretty challenging too. TDD is difficult but it has gained widespread recognition at the intellectual level. On the ground though the practice can be patchy. Why?
Before writing this article I had a look around to see what else had been written. This article on Geiger’s Counterpoint sums up my thoughts exactly. Its such a good article that I hardly have anything left to say. In fact neatly I can just provide some bullet points!
By Martin Harris on March 31st, 2010
Its astounding how often I find maps being used like this.
for(String name: names.keySet()) {
mymap.put(mymap.get(name),name);
}
Its inefficient because you have to fetch the keys and perform a lookup in the map with the key.
Instead using the EntrySet you can get all the keys and values in one hit. This saves having to perform the map lookup.
for (Entry<String, String> entry : entrySet) {
mymap.put(entry.getValue(),entry.getKey());
}
By Martin Harris on March 30th, 2010
Apologies for posting yet another backup page. There are a few people interested in the outcome, although I suspect even they are bored!
After my terrible experience with memopal, I decided to look at crashplan. Manung Han at Lab49 had a good experience. Crashplan was the next best offer price when I evaluated the first time around. This time I don’t need to go over the ADSL issues etc. If your interested in what happened last time I attempted an offline backup read on. I am going to keep this article short and to the point for fear of overloading syndicated websites like Lab49 with backup pages. I will post updates to this final page as I go.
Strategy
After the last attempt I re-thought my strategy. The new idea is to find a service that is free for the first month. Then attempt backups with Linux, Mac and Windows. These will not be full backups but big enough to test the system.
Continue reading Diary of a cloud backup – part 4 – Crashplan →