I didn't find massive amounts of information about how to link any Perl-based project to Jenkins for continuous integration, but there's a few presentations on Slideshare that carry some nice ideas.
While some older pages say that "there's no out-of-the-box integration, etc…", I think there is. A very simple, very straight-forward way to integrate any (Perl) project that uses TAP into Jenkins.
TAP::Harness::JUnit
Here we go then:
- Install TAP::Harness::JUnit
- ???
- Profit!
TAP::Harness::JUnit
will capture all the standard TAP output and turn it into the default JUnit XML output that Jenkins expects. And you don't need to do anything to make this happen. How cool is that? Read below.
Build instructions
You need to instruct Jenkins on how to build your project. So, in the "Build" panel, I usually put:
prove -I ./lib -v
If you don't use prove
, be ashamed and start using it :) You'll never look back. So, getting Jenkins to understand TAP is just a matter of modifying that command to read:
prove -I ./lib -v --harness=TAP::Harness::JUnit
Here's the actual Build panel screenshot:
That's it. prove
will produce a junit_output.xml
file with the JUnit-compatible XML output that corresponds to the standard TAP output.
Post-build actions
Now you need to tell Jenkins that the file is actually there. I'm not sure why, but this is not automatic. You need to tell it to "Publish JUnit test results". Now, if you ask me that's totally surprising, but it works. So:
That should be it. Run your build and you should see your tests output picked up.