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:15:01 GMT
Hi Supareno,

The xml files have been added to the classpath. You can see a <classpath
refid="class.path"/> in my script. This one consists my test case and input
xml files. Though I'm encountering this issue. I'm seeing the following sort
of message displayed in my console. "Couldn't load resource
org/junitext/runners/com/org/bias/engine/sal/unittest/TestData.xml ".
The null pointer exception is seen in the test report. I wonder why junit
would search the file under "org/junitext/runners" package!!!!!!!!! Believe
that's the root cause. But how to fix this is very much trivial:(

~ 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