Alexandria provides support for analyzing the output from the JUnit Ant task. JUnit is a java based framework for writing unit tests for java applications.
To anable Alexandria to use the output from the JUnit task it needs to be formatted using the xml formatter. The following example shows an example of this in the JUnit task.
|
|
|
|
<property name="test.format" value="plain"/> |
|
|
|
|
If you wish to allow developers to run tests and provide them with plain text output, using an variable which defaults to plain and can be overriden with xml via the -D option is recommended.
|
|
|
|
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<pathelement location="${build.tests}" />
<pathelement path="${java.class.path}" />
</classpath>
<formatter type="${test.format}" />
<batchtest fork="yes">
<fileset dir="${src.tests}">
<include name="**/*Test*.java" />
<exclude name="**/AllTests.java" />
</fileset>
</batchtest>
</junit>
|
|
|
|
|
Test targets are included in the global.xml file using the test tag. The test tag has two attributes buildfile and target. Buildfile is the name of the Ant buildfile which contains the test target and target is the name of the Ant target to be run. Test optionally takes a classpath (Test are always run in a seperate JVM to avoid class version problems) and arg tags that are used to pass Ant property values into Ant.
|
|
|
|
<test buildfile="build.xml" target="test" classpath="lib/mylib.jar">
<arg name="test.format" value="xml"/>
</test>
|
|
|
|
|