Hi,
I'm new to the whole Ant thing. In fact I'm new to JUnit too but I don't think that should be a problem. I'm wanted to created HTML reports with Ant as it is said here:
http://junit.sourceforge.net/doc/faq/faq.htm#running_6
" 1.
Ensure that Ant's optional.jar file is either in your CLASSPATH or exists in your $ANT_HOME/lib directory.
2.
Add an ANT property for the directory containing the HTML reports:
<property name="test.reports" value="./reports" />
3.
Define the Ant task for running JUnit and generating reports:
<target name="test-html">
<junit fork="yes" printsummary="no" haltonfailure="no">
<batchtest fork="yes" todir="${test.reports}" >
<fileset dir="${classes}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
<formatter type="xml" />
<classpath refid="test.classpath" />
</junit>
<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${test.reports}" />
</junitreport>
</target>
4.
Run the test:
ant test-html"
I have added optional.jar from the IntelliJ IDEA\lib directory to the Additional Classpath List in the Build File Propertys. I have created a folder call "reports" in the same directory as the build.xml file and changed value="./reports" to value="reports".
I then copied in the code in step three. tot he build file and surrounded it by <project name="MyProject" default="test-html" basedir="."> and <\project> tags. This, however doesn't run (I am running it from the IntelliJ Ant Build thing). I have also added the tags:
<property name="src" value="src" />
<property name="lib" value="lib" />
<property name="classes" value="classes" />
Having never used Ant before I'm not sure what the problem is. When I try to run this I get the error "Could not create class or type of type: junit" pointing to the "<junit fork="yes" printsummary="no" haltonfailure="no">" line.
If I add the target:
<target name="hello">
<echo message="Hello"/>
</target>
that will run however.
Any help would be much appreciated. Thanks.
-Sam