Friday 29 October 2010

Test reports on Hudson in 30 seconds (well, let's say quickly)

There are so many articles on how to generate test reports on Hudson for perl modules or applications, that I thought it was somehow complicated. It's not.

The underlying problem is that Hudson has support for test results in JUnit format. To solve this you need to convert from TAP to JUnit the test results.

Of course there are some pre-requirement:
  • Your perl code must have tests (duh)
  • You must have Hudson set up to run those tests
  • You need to install TAP::Harness::JUnit on the building box
  • You need to install 'prove' on the building box

Then all you have to do is add this command in the shell script you execute to run the tests:
prove --harness=TAP::Harness::JUnit
and configure the "Publish JUnit Test Result Reports" section of your project to point to the resulting XML file.

No mumbo jumbo.

Since TAP::Harness::JUnit is not available as a debian package, if you need to install it properly, just follow the usual procedure to generate debian packages from CPAN modules:

  1. wget http://search.cpan.org/CPAN/authors/id/L/LK/LKUNDRAK/TAP-Harness-JUnit-0.32.tar.gz
  2. tar -pzxvf TAP-Harness-JUnit-0.32.tar.gz
  3. dh-make-perl TAP-Harness-JUnit-0.32/
  4. cd TAP-Harness-JUnit-0.32
  5. debuild

There you go.

No comments:

Post a Comment

About ICE negotiation

Disclaimer: I wrote this article on March 2022 while working with Subspace, and the original link is here:  https://subspace.com/resources/i...