Feb 17, 2008

Maximising the Impact of Your Presentation

"I = f(K,P,T)

Your Impact is a function of your Knowledge about speaking, Practice, and Talent — in decreasing order of importance. Winston’s advice focuses on your knowledge about speaking. This is the easiest way to gain the biggest increases in your impact."


Read on...

Feb 11, 2008

Pruning My RSS Subscriptions

I'm moving from one google reader account to another and I wanted to take the oppertunity to limit the number of feeds I subscribe to. These are the ones I'm down to (in alphabetical order by blog title):

http://codeforfun.wordpress.com/feed/
http://blog.gdinwiddie.com/feed/
http://www.jamesshore.com/index.rss
http://www.jbrains.ca/weblog/rss
http://patricklogan.blogspot.com/feeds/posts/default
http://martinfowler.com/bliki/bliki.atom
http://matt.loopysoft.com/blog/index.atom
http://www.mockobjects.com/atom.xml
http://feeds.feedburner.com/nigelthorne/blog
http://tapestryjava.blogspot.com/feeds/posts/default
http://www.testearly.com/feed/atom/
http://www.clevegibbon.com/wordpress/feed

Feb 9, 2008

Agile Open Northwest 2008: Seattle, Washington - March 18-19


Registration opened yesterday for Agile Open NW. I got a lot out of last year's event so I'm disappointed that I won't be able to make it this year.

Feb 7, 2008

J B Rainsberger on Effective Testing of Web Applications

I put this question to J B Rainsberger which we answers in this podcast. Here's my transcript of his response:

Web applications are becoming increasingly complex on the client-side. What strategies are you employing for effective testing of the client-side and, if such tests are slow, what are you doing to ensure your team's commit build remains fast?

"That's an interesting one because for the most part the teams that I work with aren't yet at a level of sophistication to where they're able to tackle that problem. I don't mean to speak ill of people who aren't here to defend themselves, it's just the fact of the matter that they're not really sure how to design simple Java classes effectively. I don't know how they're going to do it once you throw Java, JavaScript, HTML, CSS in this big soup.

Now I've seen Google Web Toolkit, and I haven't had a chance to play with it much, but I have friends who've played with it say the returns are great and one of the things [Google] have done is said "Well, if test-driving JavaScript is difficult because it's JavaScript why don't we just turn it into Java because we know how to test-drive Java code". So that's one of the many things that Google Web Kit does to solve this problem.

Most of the code I write these days is in Rails, and the Rails libraries are built for this kind of thing. The people who write these libraries - the people who abstracted Rails from BaseCamp - were already TDD practitioners. And so, there just aren't as many problems to overcome because most every thing's been built with test-driving and evolutionary design and the testing environment in mind.

Evaluate the libraries and tools that are built for test-driven development, or built to be tested, and throw all the other ones away. The central message is "If it's not helping you work the way you want to work, find something else that does". It amazes me the number of people who decide to be hamstrung or allow themselves to be handcuffed. It really doesn't have to be that way. If it's not helping throw it away, find something that helps."

Humph. I'd pretty much like to restate the question: Assuming you've already found the best tools for the job, what strategies are you employing for effective testing of the client-side and, if such tests are slow, what are you doing to ensure your team's commit build remains fast?

Feb 6, 2008

TimeLord: Adding Test Framework Support - Part IV

I wanted to get JBehave to support a @TimeLord annotation and use it to declaratively freeze the system clock for specifications. I pawed over the code and it wasn't open for this kind of extension. So out came the crowbar. I've added code to TimeLord to use javassist to decorate JBehave's main BehaviourListener. Dangerous, it leaves TimeLord integration open to breakage as the internals of JBehave change ... but man does it work! Who says Java's no fun anymore? I might consider hacking the same thing for TestNG.

So now you can do this:

@TimeLord
public class SystemClockFrozenBehaviour {
// yep, the system clock will appear to be frozen for all specifications
}

Feb 5, 2008

TimeLord: Adding Test Framework Support - Part III (aka Pain Extending TestNG)

I thought TestNG supported pluggable annotations. Seriously, it doesn't!? I'm starting to feel bad for having said this was awkward in JUnit! Do you know how I achieve something like this with TestNG?

@Test
@TimeLord
public void testClockIsFrozen() {
// @TimeLord annotation calls Clock.freeze before this method
// and, finally, Clock.thaw afterwards
}

TimeLord: Adding Test Framework Support - Part II

Ok. I've added a JUnit 4 Runner to allow the system clock to be frozen for all tests in a test case. You can do this using:

@RunWith(TimeLordRunner.class)
This works well enough as long as you don't already want to use @RunWith for something, and as long as you're happy for all tests to have the clock frozen. Does the latter bother anyone? If so I could introduce a test-level annotation.

TimeLord: Adding Test Framework Support

Decorating tests in JUnit is pretty clumsy in IMO. Regardless, I've gone ahead and added support for JUnit 3.8.1 tests. You can now extend TimeLordTestCase which will freeze and thaw the clock in it's setUp and tearDown. Alternatively you can decorate tests using TimeLordTestSetup. E.g.:

public class FrozenClockTest extends TimeLordTestCase {
// the system clock is now frozen for all tests
}
Or:
public class FrozenClockTest extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();

suite.addTestSuite(FrozenClockTest.class);

return new TimeLordTestSetup(suite);
}

// the system clock is now frozen for all tests
}
Of course there's nothing stopping you doing the plain vanilla:
  protected void setUp() throws Exception {
super.setUp();
Clock.freeze();
}

protected void tearDown() throws Exception {
Clock.thaw();
super.tearDown();
}

Feb 4, 2008

A Buildr Buildfile

Just in case you've heard of buildr but don't know what a build file might look like here's the one I'm using for timelord:

VERSION_NUMBER = "1.0.0"
NEXT_VERSION = "1.0.1"
GROUP = "TimeLord"
COPYRIGHT = "Merlyn Albery-Speyer"
JAVASSIT = "jboss:javassist:jar:3.6.ga"
repositories.remote << "http://www.ibiblio.org/maven2/"

desc "The Timelord project"
define "TimeLord" do
project.version = VERSION_NUMBER
project.group = GROUP
manifest["Implementation-Vendor"] = COPYRIGHT
compile.with JAVASSIT
test.compile.with JAVASSIT
test.using :java_args=> [ "-Djava.system.class.loader=org.timelord.TimeLordClassLoader" ]

package(:jar)
end

TimeLord Released!

You can now download v1.0.0 of the jar from google code.

The JVM arg you'll want your test target to use is -Djava.system.class.loader=org.timelord.TimeLordClassLoader, and in addition to timelord, you'll be needing to specify javassit as a test-time dependency:

buildr:
test.compile.with "jboss:javassist:jar:3.6.ga"
maven2:
<dependency>
<groupId>jboss</groupId>
<artifactId>javassist</artifactId>
<version>3.6.ga</version>
<scope>test</scope>
</dependency>


... which build config do you prefer? ;)

Edit: and if you really don't use a build system that understands the maven2 repository, then you can go download javassit manually for yourself.