0
votes

I'm new to ant, and stackoverflow as well :-)

I got this problem when running junit test, tried different ways to solve it, it's been 2 days and I got nothing:-(

I mannuly downloaded ant-junit jar, since ivy says it can't do the retrieve for me :-(

my build.xml, just the relevant part:

<property name="FileTest" location="${user.home}/software_construction/hg/armidale_students/build/classes/armidale/api/io"/>
<property name="FileTestFiles" location="${user.home}/software_construction/hg/armidale_students/src/armidale/api/io"/>
<property name="JunitJarLocation" location="${user.home}/software_construction/hg/armidale_students/lib/junit-4.11.jar"/>
<property name="hamcrestLocation" location="${user.home}/software_construction/hg/armidale_students/lib/hamcrest-core-1.3.jar"/>
<property name="antjunitLocation" location="${user.home}/software_construction/hg/armidale_students/lib/ant-junit-1.9.3.jar"/>

  <junit printsummary="yes" haltonfailure="yes">
  <classpath refid="classpath.test" />


  <batchtest todir="${JUnitTestOutput}">

    <fileset dir="${FileTestFiles}">
      <include name="*Test*.java" />
    </fileset>
    <formatter type="brief" usefile="false"/>
    <formatter type="plain"/>
  </batchtest>


  </junit>

so .java files are in the src folder, and .class files are in the lib folder Pre thanks for anyone who answers!

Update:

 <path id="classpath.test">
 <pathelement location="${user.home}/software_construction/hg/armidale_students/lib/ant-     junit-1.9.3.jar"/>

 <pathelement location="${user.home}/software_construction/hg/armidale_students/lib/junit-4.11.jar}"/>


 <pathelement path="${FileTest}" />

 </path>

I don't know why it needs four spaces to generate the code.....anyway, the path code is as above

1
It would be great to have all build.xml and error stacktrace. Otherwise it is more a sort of guessing.olyv

1 Answers

0
votes

Please have a look at the build.xml of this template project: https://github.com/mplacona/java-junit-template-project