Testing shell code and producing TAP using Jenkins?

Definitely reading Hacker News before going to bed is a bad idea :-) Same goes for Reddit. So, I found a link about Bats, a tool to execute tests in Shell and output TAP - Test Anything Protocol. Then I thought; why not ask the author to include Bats under the list of Producers in testanything.org?

But you know what? Why not execute execute locally first to check if that’s working… moreover, why not use Jenkins TAP Plug-in and see what happens?

Here’s what is necessary.

Install Jenkins, tap plug-in and git plug-in. Create a new free style build. Add Bats git repository url under SCM. This way Jenkins will retrieve Bats code from Github (you don't need to install it if you don't want to). Add a build step which executes the following shell code: ./bin/bats test/bats.bats > test.t

Before executing the build, you have to check the option to publish TAP results in the end of the configuration screen. That’s it. Execute your job, chug the remaining of your beer and now you can go to bed… or just refresh Hacker News and Reddit once more…

Bats is a very nice TAP producer for Shell. Haven’t had time to play with the other producers for Shell, or explore Bats thoroughly, but it looks very promising. Hope to see more people writing tests for shell code.

Cheers -B