Monday, 15 July 2013

java - Ant - Setting ClassPath Does Not Work For Batch Test -



java - Ant - Setting ClassPath Does Not Work For Batch Test -

i have , works fine:

<target name="runjunit"> <junit> <classpath> <pathelement path="${build}"/> <fileset dir="lib"> <include name="*.jar"/> </fileset> </classpath> <test name="com.xyzcompany.abcproject.test.junit.calculatortest"/> <formatter type="brief" usefile="false"/> </junit> </target>

however, have multiple tests. this:

<target name="runjunit"> <junit> <classpath> <pathelement path="${build}"/> <---- doesn't seem work anymore <fileset dir="lib"> <include name="*.jar"/> </fileset> </classpath> <batchtest> <fileset dir="com/xyzcompany/abcproject/test/junit"> <include name="**/*.*"/> </fileset> </batchtest> <formatter type="brief" usefile="false"/> </junit> </target>

however, tells me directory doesn't exist:

c:\users\me\desktop\repository\mainproj\trunk\com\xyzcompany\abcproject\test\junit not exist.

the above should be:

c:\users\me\desktop\repository\mainproj\trunk\build\com\xyzcompany\abcproject\test\junit

as see, pathelement in classpath set trunk/build/com in single test, doesn't in batchtest.

directory , bundle names obfuscated privacy.

any thought how can alter batchtest pathelement in classpath works? thanks!

edit:

this doesn't work:

<batchtest> <fileset dir="${build}/com/xyzcompany/abcproject/test/junit"> <include name="**/*.*" /> </fileset> </batchtest>

it gives me:

java.lang.classnotfoundexception: calculatortest

setting <fileset dir="${build}/com/xyzcompany/abcproject/test/junit"> doesn't create sense since class doesn't know under build. thus, setting classpath right option, doesn't work <batchtest>.

edit 2:

now think it, create sense <fileset dir="${build}/com/xyzcompany/abcproject/test/junit">. however, when spins java junit doesn't run junit ${build} classpath.

edit 3:

<batchtest> <fileset dir="${build}"> <include name="com/xyzcopmany/abcproject/test/junit/*"/> </fileset> </batchtest>

final answers. ant should have improve documentation. complex product...

set

<fileset dir="com/xyzcompany/abcproject/test/junit">

to

<batchtest> <fileset dir="${buildtests}"> <include name="**/*test*.class"/> </fileset> </batchtest>

do not include com/xyzcompany/abcproject/test/junit part in ${buildtests}.

java ant junit

No comments:

Post a Comment