ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamesh Parameswaran <kapar...@cisco.com>
Subject RE: Exceptions while executing JUnit
Date Wed, 09 Sep 2009 04:33:16 GMT
Hi All,
I'm also encountering another sort of exception in the same run. The trace
is as follows,


Resource com/cisco/cp/engine/sal/unittest/data/TestData.xml loaded from ant
loader
Class java.io.File loaded from parent loader (parentFirst)
Class java.net.URI loaded from parent loader (parentFirst)
Class java.net.URL loaded from parent loader (parentFirst)
    [junit] Running com.cisco.cp.engine.sal.unittest.TestGenTest
    [junit] junit.framework.TestListener: tests to run: 1
    [junit] junit.framework.TestListener: startTest(initializationError0)
    [junit] junit.framework.TestListener: addError(initializationError0, URI
is not hierarchical)
    [junit] junit.framework.TestListener: endTest(initializationError0)
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit] Test com.cisco.cp.engine.sal.unittest. TestGenTest FAILED
     [echo]  Test Execution Completed...

What does this really means. While it is able to locate the resource why
would it fail at the same line
Throwing this sort of an exception. I've read much about this exception and
I don't think anything is wrong with the way in which I'm passing the
inputs. Can someone help me out in this. I do have a brief explanation of
the probable reason for this exception. It is actually thrown out from
XMLParameterizedRunner class from Junit and not from my testcase.


~ Kamesh.



-----Original Message-----
From: supareno [mailto:reno.rkcrew@free.fr] 
Sent: Wednesday, September 09, 2009 2:18 AM
To: Ant Users List
Subject: Re: Exceptions while executing JUnit

Kamesh,

are you sure that your xml file is in the classpath?
the xml file MUST be in the classpath.
To achieve this goal, you should add it in your classapth definition 
like this:

 <path id="<your_junitext_classpath">
    <!-- libs -->
    <pathelement path="${xml_file}" /> 
 </path>

hope this help :-)

supareno
> Hi All,
>
>  
>
> I'm trying to execute certain test cases as a part of my build.
>
> I'm using the ant's junit task to accomplish this.
>
>  
>
> My build script is as follows,
>
>  
>
> <junit fork="no" maxmemory="1024" includeantruntime="yes"
printsummary="yes"
> haltonerror="yes" haltonfailure="yes" filtertrace="false"
showoutput="yes">
>
>             
>
>                               <classpath refid="derbyClient"/>
>
>                               <classpath refid="derby"/>
>
>                               <classpath refid="derbynet"/>
>
>                               <classpath refid="saltest"/>
>
>                               <classpath refid="webinf.lib"/> 
>
>                               <classpath refid="class.path"/>
>
>                               <classpath refid="webinf.general"/>
>
>             
>
>             <formatter type="plain"/>
>
>                   <batchtest todir="${reports.test}">
>
>                   <fileset dir="${component.class.dir}">
>
>                         <include name="**/${TestCase}"/>
>
>
>                   </fileset>
>
>             </batchtest>
>
> </junit>
>
>  
>
> I've test case which takes inputs from *.xml files and runs. The
> implementation is as follows. 
>
> I'm using @RunWith(XMLParameterizedRunner.class) and pass my arguments
> through @XMLParameters("/com/org/bias/engine/sal/unittest/TestData.xml").
> TestData.xml is the input file which contains the input data for the test
> cases.
>
>  
>
> JUnit suffers the exception at the following constructor.
>
>  
>
> Line1 :     @XMLParameters("/com/cisco/cp/engine/sal/unittest/data/
> TestData.xml")
>
> Line2 :         public TestGenTest(TestData create,TestData update,
TestData
> delete) { // TestData here is my bean
>
> Line3 :                    this.createAttributes = create;
>
> Line4 :                   this.updateAttributes = update;
>
> Line5 :                   this.deleteAttributes = delete;
>
> Line6 :         }
>
>  
>
> The exception occurs at Line1
>
>  
>
> Testcase: initializationError0 took 0 sec
>
>      Caused an ERROR
>
> null
>
> java.lang.NullPointerException
>
>      at java.io.FileInputStream.<init>(FileInputStream.java:103)
>
>      at
>
org.junitext.runners.parameters.factory.DigesterParameterFactory.createParam
> eters(Unknown Source)
>
>      at
>
org.junitext.runners.XMLParameterizedRunner$RunAllXMLParameterMethods.getPar
> ametersList(Unknown Source)
>
>      at
>
org.junitext.runners.XMLParameterizedRunner$RunAllXMLParameterMethods.<init>
> (Unknown Source)
>
>      at org.junitext.runners.XMLParameterizedRunner.<init>(Unknown Source)
>
>      at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>
>      at java.lang.reflect.Constructor.newInstance(Constructor.java:494).
>
>  
>
>  
>
> FYI. Everything is at place.. I didn't find any issues with the classpath.
> Could someone throw lights on the annotated @XMLParameters() method, since
> I'm not much familiar about what it's up to.
>
>  
>
>  
>
>  
>
> Thanks and Regards,
>
> Kamesh
>
>  
>
>
>   



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


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


Mime
View raw message