You are correct, we don't want to have the build system setup our test
fixtures/env for us if possible.
So the simplest thing we do in Maven is provide a string with the projects
directory so you can build
up a path to external data in your testcases.  The system property is called
'basedir' and you can check 
ProjectMapperTest.java in maven test sources, the setUp() method, for an
example of usage.

If you have more ideas/feedback on this issue we are in no way slamming the
book on it.  But for now this
seems cleanest, but may be difficult.  Tests should setup themselves not
rely on the build system to setup
 the environment before hand.  Does this solution work for you?

=================================================================
Jeffrey D. Brekke                                   Quad/Graphics
[EMAIL PROTECTED]                              http://www.qg.com


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 29, 2002 9:30 AM
> To: [EMAIL PROTECTED]
> Subject: [maven] Test cases and external files
> 
> 
> What's the recommendation for test cases locating external files with 
> maven?
> 
> One of my test cases is failing because it's expecting to be 
> able to find 
> a file relative to the build file using:
>         new File("relative path goes here")
> 
> There is obviously a different working directory in use calling 
> maven:test. 
> 
> I could use Class.Loader's getResource method, but I'm sure 
> you guys would 
> have done this one before, and have a general recommendation
> --
> dIon Gillard, Multitask Consulting
> Work:      http://www.multitask.com.au
> Developers: http://adslgateway.multitask.com.au/developers
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

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

Reply via email to