ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas L Roche <tlro...@us.ibm.com>
Subject testing ant failure
Date Fri, 11 Nov 2005 21:34:17 GMT
<Apologies in advance for cross-posting, but I couldn't decide which
list was more appropriate.>

How to test that an ant script fails appropriately? Specifically:

I'm working on a build app (a java app for building lots of different
things in lots of different places) that basically {creates, shleps,
invokes} ant scripts. I have a few JUnit tests on the app (and am
writing more). I'm hooking in a scanner that causes a build to fail if
a build prerequisite is not found. I know the scanner works because I
can manually

* move a prereq file so that it's not where the build expects it

* see the BUILD FAILED message corresponds to the message attribute of
  the appropriate <fail> task

(Unfortunately existing, downstream tests in the current suite (that
look for the appropriate build outputs) don't fail: they greenbar (in
eclipse's runner), presumably because they don't run.)

I'd prefer to automate this, e.g. to create one or more separate
suites with

* setUp() that sets up the prereqs not-quite-correctly, then invokes
  the build

* a testBuildFailed() that checks for failure

* a testBuildFailedAppropriately() that checks for appropriate failure

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? Note that I do have access to the app
code and scripts, and I am more-than-willing to instrument them for
testability.


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


Mime
View raw message