Blog Entries tagged testing
Feeds: RSS | Atom

Continous Integration with Hudson - embarrasingly simple!

Published: 2011-01-27 19:24 UTC. Tags: open source software testing

I'm working on a rather large reporting and analytics application that runs on top of Hadoop at work. It has tests. A whole bunch of them, actually. That's good.

So far, we've been running the tests manually when making new releases. But doing it more often is always better, since it gives you an indication on when things went wrong, and also forces you to keep your tests in a state where they pass. Some people call it Continous Integration.

Now, you can do all the work getting your builds to build and run tests yourself, via cron and scripts and other types of messiness. Or you can try an existing solution. Today I decided to try Hudson.

That turned out to be embarrasingly simple to get started with. Basically, it's a matter of:

  1. Downloading hudson.war from their site.
  2. Start it by running java -jar hudson.war
  3. Go to http://localhost:8080 with a web browser of your choice. That would be Opera in my case. You have to eat your own dog-food.
  4. Go to the Hudson management screen and enable the git plugin
  5. Setup a new project. Tell it where the code is and on which branch.
  6. Configure what commands to run to build and test. Make the test command output an xunit xml file.
  7. Tell Hudson where that xml file is.

Result: Hudson will periodically poll git and run my build and test commands, then show a changelog and what tests failed. All this after 30 minutes of setup time. I'm impressed.

0 comments.

Yes, unit testing can be fun :-)

Published: 2007-01-15 21:49 UTC. Tags: software testing software engineering

Yesterday, I read one of the teaser chapters of Pragmatic Unit Testing in Java with JUnit.  It was a very interesting chapter, so I eventually ordered the book.

According to the reviews and from the looks of the table of contents, it doesn't talk too much about JUnit, but instead about general unit testing methodology in general which is what I want, as I don't do Java programming unless I can avoid it (another book on my bookshelf is btw Beyond Java, and although I think the author believes a bit much in XML as a must for the future, I feel that most of the conclusions in that book are something I can agree with - Java is on its way out, except as a niche language for "enterprise" applications. I don't know what "enterprise" is supposed to mean - "expensive and slow", perhaps?

Anyway, today at work, I had to rewrite a function that reads /etc/ldap.conf and parses out some LDAP server connection info. I had to read in more data, and change its API slightly as it was limited in the amount of data it could return. Inspired by the book, I started by writing some unit tests (using PyUnit) and then added more as I added features to the function.

Being able to run the tests while adding features, making sure that adjustments to parse and return a new type of data didn't break old data, made me fee happy and productive. Having to think about what kind of data should be returned and therefore tested also gave a better and more complete design.

In short - I'll be writing more unit tests from now on. I'm sure the book (when it arrives) will give me plenty of inspiration.



0 comments.