You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Stefan Bodewig <bo...@apache.org> on 2002/01/28 16:15:24 UTC

Re: Is there a way for me to access the basedir attribute from my JUnit Tests

On Mon, 28 Jan 2002, <ma...@handtolvur.is> wrote:
> I have a unit test where I need access to the directory specified by
> the ${basedir}property in build.xml.  Is there any way I can access
> that property from within my JUnit tests.

Add a <sysproperty> element to your <junit> tasks, something like

<sysproperty name="basedir" value="${basedir}" />

then it will be set as a system property and you can retrieve it via
System.getProperty("basedir").

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Is there a way for me to access the basedir attribute from my JUnit Tests

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 28 Jan 2002, <ma...@handtolvur.is> wrote:

> the only modification was that sysproperty takes a "key" attribute
> instead of "name"

Thanks

        Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Is there a way for me to access the basedir attribute from my JUnit Tests

Posted by Magnus ?or Torfason <ma...@handtolvur.is>.
Thanks, that was the solution, the only modification was that sysproperty
takes a "key" attribute instead of "name"

<sysproperty key="basedir" value="${basedir}" />

Cheers,

Magnus

> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@apache.org]
> Sent: 28. januar 2002 15:15
> To: ant-user@jakarta.apache.org
> Subject: Re: Is there a way for me to access the basedir attribute from
> my JUnit Tests
>
>
> On Mon, 28 Jan 2002, <ma...@handtolvur.is> wrote:
> > I have a unit test where I need access to the directory specified by
> > the ${basedir}property in build.xml.  Is there any way I can access
> > that property from within my JUnit tests.
>
> Add a <sysproperty> element to your <junit> tasks, something like
>
> <sysproperty name="basedir" value="${basedir}" />
>
> then it will be set as a system property and you can retrieve it via
> System.getProperty("basedir").
>
> Stefan
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>