//given //when //then forever

December 7, 2009
@Test
public void shouldDoSomethingCool() throws Exception {
    //given
	 
    //when
 
    //then

}

I like to call it the Ultimate Test Template. I’m so fond of those 3 little comments but surprisingly, I didn’t buy it at first. Micheal (it’s you, tapestry-maven-iPhone fan boy =), friend from ThoughtWorks showed me it a couple of years ago. Actually, he didn’t show it to me – I just overheard him coaching a young dev about it. That day I thought I didn’t need any hip comments because my tests were great anyway. It was foolish.

Don’t be a fool like me and start writing //given //when //then today. Life is too short for messing around – you want to get level 85 in software craftsmanship soon, right? Here’s the deal: use the template for 1 iteration and if you don’t like the results then I will give you your money back. Seriously, no matter what you think about it – buy it! BTW. If you need to document some ‘exceptional’ behavior in your test somewhere there is the template for tests with exceptions.

Lately, I’ve been selling //given //when //then quite relentlessly. I even try to sell it via Mockito api. (The link also shows how to install the template in Eclipse so don’t miss it!)

I tried to lobby for the Church of given-when-then in Krakow, Warsaw & Kiev. I heard rumors that Wroclaw develops a growing number of brothers and sisters in faith =)

I think I forgot to thank Dan North for given-when-then and Liz Keogh for the idea of BDD aliases in Mockito. There you go!


How much time one can waste playing FM2007

October 11, 2007

This decent game doesn’t even try to hide its evilness: it shows you current ‘addictness rating’. I was recently promoted from ‘real football managers don’t need food’ to ‘sleeping is for sissies’. Well done Szczepan, surely you don’t have anything useful to do.

I thought I got over FM2007 weeks ago but no… I mixed two dangerous ingredients:

  • boring evening
  • hacking eclipse plugins just to realize that decent quick-fixes (with clickable bulbs and ctrl+1 shortcut) are part of JDT plugin and not really part of PDE. To get those juicy quick-fixes do I have find it in JDT and then pull in copy-paste pattern (AKA encapsulate-and-reuse pattern). Grrrrr.

F*** this. Let me have just one game…

BTW Wisla Krakow can beat AC Milan in Champions League quarter-finals! AI cheats but I can always apply magic load-game-and-replay pattern, then perform crucial refactorings to my tact, then Wisla rulez =)