Return-Path: Delivered-To: apmail-jakarta-ant-user-archive@jakarta.apache.org Received: (qmail 55632 invoked by uid 500); 20 Sep 2001 20:26:01 -0000 Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: ant-user@jakarta.apache.org Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 55610 invoked from network); 20 Sep 2001 20:26:01 -0000 Date: Thu, 20 Sep 2001 14:23:18 -0600 From: Timothy Shadel Subject: Re: How to set a property from a custom task? (LONG) To: ant-user@jakarta.apache.org Message-id: MIME-version: 1.0 X-Mailer: Novell GroupWise 5.5 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: quoted-printable Content-disposition: inline X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N I couldn't say for sure, but check out and read the section containing this: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D To create a suite of two test cases and run them together, execute:=20 TestSuite suite=3D new TestSuite(); suite.addTest(new MoneyTest("testMoneyEquals")); suite.addTest(new MoneyTest("testSimpleAdd")); TestResult result=3D new TestResult(); suite.run(result); Another way is to let JUnit extract a suite from a TestCase. To do so you = pass the class of your TestCase to the=20 TestSuite constructor.=20 TestSuite suite=3D new TestSuite(MoneyTest.class);=20 TestResult result=3D new TestResult();=20 suite.run(result);=20 Use the manual way when you want a suite to only contain a subset of the = test cases. Otherwise the automatic suite extraction is the preferred way. = It avoids you having to update the suite creation code when you add a new = test case.=20 TestSuites don't only have to contain TestCases. They contain any object = that implements the Test interface. For example, you can create a = TestSuite in your code and I can create one in mine, and we can run them = together by creating a TestSuite that contains both:=20 TestSuite suite=3D new TestSuite(); suite.addTest(Kent.suite()); suite.addTest(Erich.suite()); TestResult result=3D new TestResult(); suite.run(result); =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D I'm pretty sure you could wrap your test case classes using the TestSetup = class described in the first URL, and where it said "...add your tests and = suites here... ", you could use the methods above (e.g. TestSuite suite=3D = new TestSuite(MoneyTest.class);) to allow Java Reflection to figure out = which tests to run. Tim >>> Paul Michali 09/20/01 01:46PM >>> Timothy Shadel wrote: >=20 > For JUnit setup for several test cases check out >=20 > http://junit.sourceforge.net/doc/faq/faq.htm#How%20do%20I%20run%20setup%2= 0code%20only%20once=20 >=20 Will that work, given that I'm running JUnit from Ant and letting JUnit find all my test cases via Reflection? If not, is there a way to do this? PCM (Paul Michali) Carrier Voice Gateway Business Unit (CVGBU) Cisco Systems, Inc. 250 Apollo Drive Chelmsford, MA 01824 Phone : (800) 572-6771 x 45817 (978) 244-5817 [direct] Paging: (800) 365-4578 [voice] pcm@epage.cisco.com [email page]