Category: Software Development
-
What Units to Test?
What to cover? In my previous post I dismissed the notion that it is necessary to test every class of your system in isolation. I argued that this is fixing the protocols at all layers of your application and thus making refactorings that shuffle responsibilities around more expensive. Perryn rightly pointed out that the refactoring…
-
Test Sclerosis – The Trouble with Unit Tests
Your typical system, written in a nice object-oriented way performs its task using a number of collaborating objects that send methods to each other. Ignoring some of the complexities like objects actually creating new objects in response to message, we can draw a diagram like the one below: Each arrow represents a method call. Now…
-
Intellij 8 is here!
After using Intellij 8 for one hour, I have to say JetBrains raised the bar. What I liked: Extract Method Object Refactoring: Lets you extract an object, where you can’t extract a method, because of multiple return values. I vaguely remember having spent a lot of time doing this manually to castor’s evil 1200 line…
-
JUnit Shortcomings I
A few days back I wrote a test that used the filesystem. In order to keep my test independant from any particular file layout I usually do something like this: public class SomeFileSystemTest { @Test public void performTest() throws IOException { doStuff(tempDir); … } private File tempDir; @After public void deleteTempDir() throws IOException { FileUtils.deleteDirectory(tempDir);…
-
buildobjects 0.1 released
I have just uploaded the first very alpha release of buildobjects. buildobjects provides building blocks to implement your build process in java. It also introduces the idea of the Tasklet, that might be used for scripting tasks using java.
-
Thread Police for your Unit Tests
Writing the new ant I stumbled across the problem of test cases leaving threads behind, after returning control to the runner. My trusted colleague and JUnit Runner expert Mark Burnett and I, knocked up a quick and dirty junit runner that actually allows you to spot such a condition. Consider the following testcode: @Test public…
-
Spreadsheet Driven
I had a quite a few chats these days with people fro a more QAish background. Originally I intended just to look at selenium and webdriver. I showed some of the stuff, which I wrote in Java, to my QA colleagues. I used a demo webapp that implements a phonebook. My testcase just added a…
-
Poor man’s delegates
When writing Swing applications I find myself quite often in the Situation to write action handling code like this (Why I do write this kind of code is a different albeit also interesting story): public class Handler { Action doMyThing; public Handler() { doMyThing = new AbstractAction(“doMyThing”){ public void actionPerformed(ActionEvent e) { doMyThing(); } };…
-
“Hallmark of the Stupid”-Series – First Instalment – Velocity
There is a lot of nasty stuff to be said about velocity, but today I complain about it’s stupid whitespace-ridden syntax and it’s equally stupid error messages. I just got this one: Parser Exception: templates/myoldtemplate.vm Encountered “}” at line 19, column 101. Was expecting one of: “,” … “}” … … …
-
A Screen Camera in Java
Today I wrote a little class that allows to repeatedly capture the screen content and write the result to a flash file. It created a flash video with one frame per second (this is a bit crude) with one frame per screen shot taken. It is based on JavaSWF2 a nice wrapper around the SWF…