ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laird NELSON <lairdnel...@comcast.net>
Subject Re: RE: Testing buildfile from inside TestCase?
Date Fri, 11 Jul 2003 13:28:09 GMT
Thank you.  Since ant's distributable jar doesn't contain 
BuildFileTest, I guess I'll just cut and paste its code.  Basically it 
looks like I can't just say Main.start(); I have to:

. Create a new Project
. Set its "ant.file" property to wherever my build file is
. Call ProjectHelper.configureProject(project, new File(myBuildFile))

Hopefully this will work, although I'm not sure how this will solve my 
classloader issues.  But anyway, thanks for your help.

Cheers,
Laird

----- Original Message -----
From: Jan.Materne@rzf.fin-nrw.de
Date: Friday, July 11, 2003 8:38 am
Subject: RE: Testing buildfile from inside TestCase?

> Extend org.apache.tools.ant.BuildFileTest and see how to work with 
> that on
> org.apache.tools.ant.taskdefs.*Test.
> 
> Tests are in the source distribution /src/testcases
> 
> 
> Jan
> 
> 
> > -----Original Message-----
> > From: Laird NELSON [lairdnelson@comcast.net]
> > Sent: Friday, July 11, 2003 2:30 PM
> > To: user@ant.apache.org
> > Subject: Testing buildfile from inside TestCase?
> > 
> > 
> > I'm writing an ant taskdef.  I'd like to unit test it in JUnit 
> by 
> > generating a simple buildfile with a <taskdef> element in it 
> > referring 
> > to my taskdef and executing Ant to make sure the buildfile (a) 
> loads, 
> > (b) finds my taskdef and (c) executes it properly.
> > 
> > If I launch org.apache.tools.ant.Main.start() from inside my 
> > TestCase, 
> > my buildfile loads (i.e. ant starts up fine), but when the 
> project 
> > parser hits the <taskdef> element, it cannot find my taskdef 
> > classes.  
> > Now, what's odd is that the test case from which I'm running 
> > ant is in 
> > the same package as the taskdef itself.  Both are therefore in 
> the 
> > classpath, or I couldn't have run JUnit in the first place.
> > 
> > What's the proper way to unit test a taskdef?
> > 
> > Thanks,
> > Laird
> > 
> > 
> > -----------------------------------------------------------------
> ----
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> > 
> 


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


Mime
View raw message