On Wed, 12 Jan 2005, Robert Lin wrote:

Sorry, the subject should have been "JUnit Test Suggestions".

Robert

-----Original Message-----
From: Robert Lin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 12, 2005 2:17 PM
To: Ant Users List
Subject: Ant Users List

Hi,

Our project has a bunch of modules and with their own buildfile, and each 
buildfile would contain a set of JUnit tests that is specific to that module.  
Is there an easy way to use a central build.xml file and call the various JUnit 
targets that reside in each individual buildfiles.  And after completing all 
the tests, fail the build if any of the tests fails.

Any suggestions? Thanks in advance.

Hmm, well here's one possibility. It's not particularly pretty, but it should work. ;-)


* Have your individual <junit> tasks not halt on failures, but set a property instead. After the tests are complete, <touch> a file if there were failures (using the same file in each case).

* Use <subant> in your top level build to walk your project tree and run the tests for each module.

* When all the tests are done, check to see if the failure flag file (i.e. the one that you <touch>ed on test failure) exists. If it does, <fail> your top level build.

Using the file is necessary because properties set in the individual build files will not be available to your top level build file.

Does that help?

--
Martin Cooper


______________________________________
 
Robert Lin
Eng. Intern | Blue Jungle | Redwood City, CA [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to