opensubscriber
   Find in this group all groups
 
Unknown more information…

u : user@ant.apache.org 8 September 2009 • 6:38PM -0400

Exceptions while executing JUnit
by Kamesh Parameswaran

REPLY TO AUTHOR
 
REPLY TO GROUP




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




Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.