You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Stefan Bodewig <st...@freenet.de> on 2005/11/12 18:38:43 UTC

Re: [junit] testing ant failure

On Fri, 11 Nov 2005, Thomas L. Roche <tl...@us.ibm.com> wrote:

> What's the "best way" to test for appropriate failure? The only
> thing that comes to my mind is to parse the logfile, e.g.
> 
> * check for a "BUILD FAILED" line
> 
> * check that a line after the "BUILD FAILED" line contains the
>   appropriate failure message.
> 
> Is there an easier/better way?

Take a look at Ant's own unit tests.  There is a BuildFileTest base
class that many tests extend with helper methods like
expectSpecificBuildException() which assert an Ant build fails.

Another alternative, and Ant itself is probably heading to this, is
the newer AntUnit test framework/antlib, that can be found in Ant's
svn repository in the sandbox (which it probably is going to leave in
order to become a real Ant subproject rather soon).

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org