ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From St├ęphane Bailliez <sbaill...@imediation.com>
Subject Ant testcases properties/ JUnit sysproperty
Date Sat, 30 Dec 2000 20:20:04 GMT
Hello,

While working on enhancing the JUnit task (I was trying to see how to add
the requested haltontimeout property, see
http://marc.theaimsgroup.com/?l=ant-dev&m=97714480625784&w=2) I modified the
ExecuteWatchdog in order to know if the watchdog did killed its monitored
process  and also fixed some minor glitches. To ensure I was not breaking
anything I did the testcase for it, but...

I ran into a minor problem which is: classpath availability into JUnit
TestCases.

If I'm forking a process to run a Test process from a TestCase, I need the
classpath. (The Test process is a static inner class to the TestCase),
therefore I need ${build.tests}

If I'm forking a JUnitTestRunner it is ok, I can get the classpath via
System.getProperty("java.class.path"). However if i'm not forking a
JUnitTestRunner..AFAIK I have no way to get it.

If i'm wrong skip the next part: :)

So I think there is a need to set some testcases properties in the JUnit
targets.
Since it must be available in both forked and non forked vm, the only
solution should be:

<junit ...>
    <sysproperty key="build.tests" value="${build.tests}"/>
</junit>
(okay the key 'build.tests' is not that appropriate but you get the idea)

the sysproperty is however not supported by JUnit but this no big deal. I
takes less than 20 lines of code to add this feature. (btw ! I'm impressed
everytime by how clever the architecture is in some parts, it makes me happy
to use the API, I feel like I have every tools available because you thought
about a lot of things !!!)

I also noticed that in the build.xml it only refers to the ant.jar
(${lib.dir}/${name}.jar) and not optional.jar thus it will always use the
bootstrap optional.jar when running the testcases...

Any comments on all this ?

--
Stephane Bailliez
Software Engineer, Paris - France
iMediation - http://www.imediation.com
Disclaimer: All the opinions expressed above are mine and not those from my
company.

Mime
View raw message