On Fri, Jul 09, 2004 at 11:38:58PM -0400, Omair-Inam Abdul-Matin wrote:
> I'm using JUnit to run some regression tests that need to read in
> configuration and data files. For this it is necessary that the working
> directory be the same as the project directory. Recently the project
> was subdivided into a master project and child subprojects. Now when I
> try to run unit tests by invoking the master build target, the tests
> fail because apparently the working directory is the directory of the
> master project not the current child project. I believe this topic has
> been brought up in a previous post but I was not able to find the
> solution to the problem.
Try to read the System.getProperty( "basedir" ) should yield the basedir
for your project when you run your testcase from maven. But this is not
the case when you are running the testcase from eclipse so I'd recomend
that you make a super test case and have a method called getBasedir() like
this:
protected String getBasedir()
{
return System.getProperty( "basedir", new File( "" ).getAbsolutePath() );
}
--
Trygve
>
> Can someone please nudge me in the correction direction?
>
> Omair
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]