Monday, February 23, 2009

Lava Lamp with CruiseControl

As we are getting Phoenix project under way, I am trying to get it started right by introducing more XP practices. The first three things that we are trying to do are Paired-Programming, Test-Driven Development, Continuous Integration.

Actually, Guidewire has already built an internal tool, ToolsHarness, to handle continuous integration, as I have written in "Managing Tests with ToolsHarness, Individually". The only difference that I want to introduce for Phoenix project is to fix broken tests AS SOON AS POSSIBLE.

What this means is that I want the testing status of our branch to show right in out faces, without us having to launch a browser, so that we know to take action the moment a test is broken.

I talked to the developer who manages ToolsHarness, and he wrote a servlet that serves information about broken tests and test status like this picture, except in one HTTP GET. Then I set up CruiseControl(version 2.8.2) with X10 publisher, following the setup described on this blog post "Bubble, Bubble, Build's In Trouble".

One thing about the normal lava lamp setup has always bugged me in the past, which is when the continuous integration server is in the "testing" state. When you have test broken, the red lava lamp will be on, and you just have to remind yourself that the fix is in and test is running. In some projects, I have used "project soundscape", so that when tests finishe but are still broken, you will know about it. But if you happen to step outside, you will miss it. Or if you just came in, you have to check the browser or ask others.

So this time, I have done it a little differently, taking advantage of the fact that CruiseControl is not the process running the tests. I bought two lava lamp, one kind of in the red color and the other in blue. I set it up so that when there are two independent lava lamps:
  • Red Lava Lamp for broken tests: When there are broken tests, it will be on, otherwise, it will be off
  • Blue Lava Lamp for testing status: When there are tests running, it will be on, otherwise it will be off
In this way, you have four state to display:
  • Neither is on: All tests pass and the tests are up-to-date
  • Blue is on and red is off: All tests pass so far, but there are tests running against newer changes
  • Blue is off and red is on (see below): You have broken tests, and no code checked in to fix it
  • Both blue and red are on (see below): You have broken tests and someone has cheked in new code (hopefully to fix it)

The setup is pretty straightforward, except CruiseControl 2.8.2 release is missing two crucial files, "lib/win32com.dll" and "lib/javax.comm.properties", for X10 publisher to work. That, and me missing a tiny but also crucial detail in the documentation, caused my three-hour-hair-pulling experience, and that was with Jeffrey coming to rescue through GTalk. I am going to submit the patch for the release script to include those two files, and documentation with the following checklist:
  • You should provide all FOUR attributes related to X10 for the element, so that you are aware of them and make sure they are correct. These four attributes are as following:
    • "houseCode" and "deviceCode" are for X10 module configuration.

    • "port", with the value of COM1, COM2, etc., to match the place you plugin the COM module.

    • The last one is "interfaceModel", which you should really double check with the COM module that you have.

  • Make sure "javax.comm.properties" is in your CruiseControl lib directory (should be there after 2.8.3)
  • Make sure you copy "win32com.dll" from CruiseControl lib directory (should be there after 2.8.3) to your Java bin directory
In the end, I would like to say that I am a satisfied ci-guys customer!

3 comments:

Anonymous said...

But is it *effective*? I have used a lava lamp before, and found it way too passive. In bright rooms, it's hard to tell if it's even on; it relies on everyone having direct line-of-sight; it relies on someone actually noticing its state has changed. I have found the most effective notification is a loud noise. It's also cheaper, uses less energy, and you can mix it up by changing the sounds regularly (CCTray used to ship with Homer Simpson quotes, but no more alas).

Shane said...

Hi Jim,

Very good question! And I would say it like a consultant

"depends..."

In this case, I think Lava Lamp is effective because:

* We have only three developers, and the lava lamp is sitting between the other two developers. Yes it sucks for me to turn around all the time but I am setting up my computer to monitor it separately (firefox plugin, screen saver, etc.)
* As I have mentioned, I am doing something differently from our common practice, which is to fix the tests before pushing the code to stable branch. Since we share the development room with several other teams, I don't want the noise to have negative effect on the practices that I want to push

I had similar situation before except majority of the people want to sound, and so we did it (see "One week in China (http://agileworks.blogspot.com/2005/10/one-week-in-china.html)". This time, I will still wait until I can do it by majority votes.

Hope this explains it.

Anonymous said...

I thought your readers would enjoy some lava lamp info

History of the Lava Lamp Singapore-born Englishman Edward Craven Walker invented the lava lamp in the 1960s. His U.S. Patent 3,570,156 for "Display Device" was filed in 1965 and issued in 1968. Walker's company was named Crestworth and was based in Poole, Dorset in the United Kingdom. Walker named the lamp Astro and had variations such as the Astro Mini, the Astro Coach lantern and presented it at a Brussels trade show in 1965, where the entrepreneur Adolph Wertheimer noticed it. Wertheimer and his business partner William Rubinstein bought the American rights and produced it as the Lava Lite via Lava Corporation or Lava Manufacturing Corporation, the origin of the word "lava" for this lamp. Wertheimer sold his shares to Hy Spector. Rubinstein and Spector went on to manufacture and market the Lava Lite in his Chicago factory at 1650 W. Irving Park Rd in the mid-60s. The lamps were a success throughout the 60s and early 70s. Lava Corporation's name changed to Lava-Simplex in the early 1970s.

Hazards of the Lava Lamp An episode of the American TV show MythBusters demonstrated that heating a lava lamp on a stove could make it explode, and that injuries from an explosion could be fatal. The inspiration for that experiment came from a story concerning a man who in 2004 died after a lamp he was heating on a stove to avoid waiting for the wax to warm up exploded, sending glass into his chest.