ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lorenzo Bettini <bett...@dsi.unifi.it>
Subject problem with junit ant task and class loading
Date Fri, 12 May 2006 12:23:28 GMT
Hi there

I've just started using ant and junit task

I have a test suite that I usually run from within eclipse and always worked

one of these tests uses a custom class loader

now I see that if I try to run the test with custom class loader from
console (i.e., using junit.textui.TestRunner) everything's fine and all
the 3 test methods of the test case run successfully...  if I use a
graphical interface (i.e., junit.swingui.TestRunner) I get a
ClassCastException that is due to the fact that some classes are loaded
with different class loaders...

now I found the way to solve this problem when running junit directly: 
as illustrated in the junit FAQ I put the

junit/runner/excluded.properties

in my CLASSPATH and added lines in this file so that my classes are 
loaded through the system class loader.

However, the problem still exists if I run the ant task.  I think the 
problem is the same in that the same test never returns (and I see no 
output on the screen).

I'm using this target

<target name="junit" depends="tests" description="--> run junit tests">
     	<junit printsummary="withOutAndErr" haltonerror="on" 
                                  haltonfailure="on">
     		<formatter type="plain"/>
     		
     		<test name="...mytest..." haltonfailure="no" outfile="result">    			
     		</test>
		<classpath refid="...mypath..."/>
     	</junit>
     </target>

where mypath ensures that my excluded.properties is loaded first

am I doing something wrong, or should I use a specific option?

thanks in advance
	Lorenzo

-- 
+-----------------------------------------------------+
|  Lorenzo Bettini          ICQ# lbetto, 16080134     |
|  Home Page        : http://www.lorenzobettini.it    |
|  http://www.purplesucker.com Deep Purple Cover Band |
|  http://www.gnu.org/software/src-highlite           |
|  http://www.gnu.org/software/gengetopt              |
|  http://www.lorenzobettini.it/software/gengen       |
|  http://www.lorenzobettini.it/software/doublecpp    |
+-----------------------------------------------------+



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message