Every assertion should be thought from the standpoint of
- What was expected
- What actually happened
Translation: assertTrue should always, always have a message.
Consider the following:
This will only return "assertion failed". Which is great, but how do we know what happened? If this is buried on one of the lunt automated remote builds, how am I supposed to know what is going wrong? Which is the expected? What actually happened?
A much better version of the same looks like this:
"Was expecting something like "
+ myController.getSuccessView() + " but was "
Same assertion, but now it tells me more specifically what's going on and I can fix bugs with it. Once I set this on the test, it becomes easy to see what was going on.
I recently had a Saturday with some other Bay Area developers where we did a lot of thinking about testing, so expect some more advice in the future as I collect my notes.
Remember the goal of unit tests is to "find bugs" (thanks Harry!). An assertion without an associated message merely notifies you that a bug occurred but doesn't actually "find it". As you are writing your unit tests, make sure you find it as well.
technorati tags:testing, junit, assertions, java
Last time I didn't write this down and this time I'm blogging about it so I don't forget it. OSX Hints has a good guide on how to set Terminal.app to work the way God Intended (great command line user that He is).
I am handy around the Terminal.app, but for me the main thing that I kept forgetting (and hurts me a lot since my muscle memory depends on it) is moving forward and backwards full word:
By the way, have I mentioned I no longer have to use PCs? Woot!
Update: Here is another guide you may want to take a look at. And another
technorati tags:osx, terminal.app, bash
February 7th, 2007 in
Graeme over at Contrado Solutions has put together some Scrum Poker Cards. These are good for Poker Estimation.
technorati tags:scrum, estimation
February 3rd, 2007 in
I've spent the last few months implementing GTD and I'm still getting used to it, although I feel I'm achieving a comfortable rythm. One of the big "ah-hah" moments in this process however is the difference between our "hunting" and our "gathering" brains. The basic premise of dividing your time in "collecting without doing" and then "doing without collecting" is what makes you feel like you're "in the zone" when you're doing stuff and gives you a relaxed feeling when you're done collecting your stuff.
After doing this for a little bit and then having a small crisis on a Scrum project (where requirements for the current sprint kept changing during the sprint). I realized that one of the big sources of mental stress is precisely trying to do both at once. Our brains just don't seem to be able to handle it.
The way I see it, our brains are pretty much still cavemen brains, used to running out and hunting deer for a very long period of time, and then going out and foraging for food for another long period of time. If you get into a "chase" mode when you're foraging, it means you're the one being chased, and it automatically fires our stressors.
Here are some funny/interesting Scrum related videos:
technorati tags:scrum, xp
December 8th, 2006 in
This opens pretty interesting possibilities:
Wazaabi includes a GUI framework that brings XUL to Eclipse RCP plugin developers and a set of components that link the client-side XUL based viewers and forms to server-side business components. Thus, rich client developers can use XUL to code a GUI, rather than using SWT.
Wazaabi brings XUL to Eclipse RCP based rich client applications
This is an actual XUL viewer, not a similar syntax like XSWT or similar attempts. They use servlets to communicate between the XUL side and your application, to keep the flexibility of sending the XUL to a mozilla browser. Very interesting.
technorati tags:java, xul, eclipse
This is a quick little cheatsheet with my favorite eclipse plugins and the locations of their update sites. It's so I can get back up and running quickly when reinstalling eclipse from scratch.
- Eclipse Checkstyle - http://eclipse-cs.sourceforge.net/update
- Spring IDE - http://springide.org/updatesite/
- Fitnesse by Band XI - http://www.bandxi.com/fitnesse/
- Subversion for Eclipse - http://subclipse.tigris.org/update_1.0.x
- Memory Monitor - http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-ui-home/updates
- Mylar - http://download.eclipse.org/technology/mylar/update-site/e3.2 (or e3.3)
Also, here's some stuff that I like to install manually:
technorati tags:eclipse, plugins, java
November 15th, 2006 in
Boy don't I know this - in a prior life I wrote a GEF editor for a workflow engine.
Let me be blunt: In the past, creating graphical editors within Eclipse using the Graphical Editor Framework (GEF) was slow and painful. It involved understanding a complex framework and quite a bit of redundant code. That said, GEF is an excellent framework for creating graphical editors because it is model-agnostic. On the other hand, being model-agnostic creates its own problems.
Learn Eclipse GMF in 15 minutes
September 15th, 2006 in
Fun and entertaining early Linux History, from Lars Wirzenius:
At one point, Linus had implemented device files in /dev, and wanted to dial up the university computer and debug his terminal emulation code again. So he starts his terminal emulator program and tells it to use /dev/hda. That should have been /dev/ttyS1. Oops. Now his master boot record started with "ATDT" and the university modem pool phone number. I think he implemented permission checking the following day.
technorati tags:linux, history
September 15th, 2006 in
If you've followed this for a while you probably know I love emulation and retrocomputing. I'm a big time history geek. Which is why I found this history of the OSX Screen of death entry I found on OSNews pretty cool. And of course I also love when I can tweak things:
Mac OS X allows a custom panic image to be loaded into the kernel from user space. This can be useful in certain circumstancesâ€”for example, if it is desired that the user of a managed system notify the administrator in the case of a panic, a custom image can be used to instruct the user.
A New Screen of Death for Mac OS X
It's almost too bad I have only seen the screen once ever on the Mac OS (knock on wood). How would you test this? Parallels for mac, when are you going to run OS X?
September 14th, 2006 in