sometimes nothin' can be a real cool hand

« Demonstrating continuous integration | Main | CI Demo Part 3 - Maven Build »

CI Demo Part 2 - Template Application

Listen to this article Listen to this article

I've started down the road to building my continuous integration demo by setting up a template application with some of the basic tools listed previously.

There's no real code to speak of yet, just a HelloWorld class and an associated test, but most of the surrounding tools are set up in a directory structure that I like. You can download the application template if you like to see how it works. Its about 2MB in size, as the tools for all jars are included. You'll need Ant 1.6 to build it.

There's a couple of interesting things about the build which I don't see all of the time. Firstly, I separate the application source and test code. Not so dramatic, but I don't see everyone do it. I also compile each source tree to their own classes directory, which enables application source to later be bundled into the distribution without tests. The technique is also a sanity check that application source does not depend on test source.

This was my first attempt at using Ant 1.6, and I've had a go at creating some macros for compilation and testing respectively. So far I like it. My build file is certainly cleaner for the effort.

The remaining tools were simian, checkstyle and jcoverage. I haven't done anything too fancy with them, and I haven't completely tweaked the checkstyle config to my liking yet. In any case - they're in and working. The version of JCoverage includes the patch for simple bean-like properties produced by Jon Eaves.

Thats it so far. My next step is to expand it to be a simple web-app with a FIT test. Then I'll wrap cruise control around it and start building actual features ;)

Comments

I'm interested to know why you separate the application and test source code? I find it far more convenient to see the test and functional class side-by-side. Makes it easy to browse between the two.

I used to feel the same way, and its probably ok for small apps. But a couple of good reasons are:

* Its useful to verify that the application code can compile and run independantly of test code.
* It makes it easy to deploy just the application code to production.

Check out the build file to see examples of these points.

A good IDE should make it easy to see classes side by side even if they are in different trees (they are still in the same package).

Dude.

If you put this all into a nice little package for Cruise Control demos I will send you a six-pack of the best American beer I can lay my hands on.

...maybe I should think of a more inticing incentive ;-)

Post a comment