Goodbye Hello World

By | October 28, 2013

It’s time to say goodbye to the old standard hello world program. Not because it don’t work, but because it is the wrong approach. I think it’s time to welcome Hello Test instead.

Now a days it is nothing uncommon in trying to test first by applying TDD. But that must also mean that the most important thing that we start a new project with is a single test method like the following (jUnit notation)

public HelloTest {
    @Test
    public void helloTest() {
        assertEquals("Hello Test", "");
    }
}

This will make the test fail, so in true TDD fashion you must now make the test pass. Then its time for some re-factor and begin to produce business value.

Way is this more important the the hello world program? Imho I now assume that the main method will be invoked, but it is note always true that the test will run directly. You may have forgotten some dependency or the environment is not properly configured etc. etc. This can stop you from doing it the right way, the test driven way.

I think that it is really important to be able to easily run the tests as often as possible. At the moment I am using eclipse with the MoreUnit plugin which make it really simple to run the tests, just hit CTRL-R. It also make it simple to jump between the test class and the unit under test (UUT).

So when I try a new language or development environment the most important thing, for me, is to be able to run the tests. This must be done as easy as possible so that I can run them as often as I like.

3 thoughts on “Goodbye Hello World

  1. Pingback: TDD with Jasmine | Aidium

  2. Pingback: FizzBuzz kata with Akka | Aidium

  3. Pingback: TDD with Venkat | Aidium

Leave a Reply

Your email address will not be published. Required fields are marked *