Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

In our development environment We have more and more build scripts for ant to perform the build tasks for several different build jobs.

These build scripts sometimes become large and do a lot of things and basically is source code in and of itself.

So in a "TDD-world" we should have unit tests and coverage reports for the source code.

I found AntUnit and BuildFileTest.java for doing unit tests. But it would also be interesting to know the code coverage of those unit tests.

I have been searching google, but have not found anything. Does anyone know of a code coverage tool for Ant build scripts?

share|improve this question

2 Answers 2

If you convert your Ant scripts to gant (which has a lot of other advantages), then getting coverage would be trivial.

Gant is a tool for scripting Ant tasks using Groovy instead of XML to specify the logic. A Gant specification is a Groovy script and so can bring all the power of Groovy to bear directly, something not possible with Ant scripts. Whilst it might be seen as a competitor to Ant, Gant uses Ant tasks for many of the actions, so Gant is really an alternative way of doing things using Ant, but using a programming language rather than XML to specify the rules...

share|improve this answer
    
Thanks for your answer. I was not planning to use Groovy, but I will have a look at it. –  pablaasmo Dec 3 '12 at 13:03
up vote 1 down vote accepted

To answer my own question :-)

I have ended up using AntUnit to do unit testing of Ant Build scripts. To to coverage I did not find a tool/library that works out of the box. What I did find that might be usable with some adjustments is Antro (https://sourceforge.net/projects/antro/) with its code at https://github.com/jkff/antro.

Antro is "Ant profiler: a line-level profiler for Ant build scripts"

It uses a listener to collect data about the build script run.

The challenge is to try to use Antunit and Antro together or make a listner for Antunit that can do the same as Antro to collect data.

But then again that might my an interesting challenge to do :-)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.