/usr/share/doc/libantelope-java/manual/bk03ch26.html is in libantelope-java-doc 3.5.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 26. TestCase Task</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Antelope Users Guide"><link rel="up" href="bk03.html" title="Additional Ant Tasks"><link rel="prev" href="bk03ch25.html" title="Chapter 25. Suite Task"><link rel="next" href="bk03ch27.html" title="Chapter 27. Performance Monitoring"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 26. TestCase Task</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk03ch25.html">Prev</a> </td><th width="60%" align="center">Additional Ant Tasks</th><td width="20%" align="right"> <a accesskey="n" href="bk03ch27.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter 26. TestCase Task"><div class="titlepage"><div><div><h2 class="title"><a name="testcasetask"></a>Chapter 26. TestCase Task</h2></div></div></div>
@style@
<p>
Modeled after the TestCase provided by jUnit, this class is an Ant task that
looks through the build file that contains this task, calls a 'setUp' target
(if it exists), then all targets whose names start with 'test', and last calls
a target named 'tearDown' (if it exists). Both 'setUp' and 'tearDown' are
optional targets in the build file.
</p><p>
Ant stores targets in a hashtable, so there is no guaranteed order in which
the 'test*' targets will be called. If order is important, use the 'depends'
attribue of a target to enforce order, and do not name dependent targets with
a name starting with 'test'.
</p><p>
Most unit tests will make use of Assert. As the Assert task requires that the property "ant.enable.asserts" be set to true before it will do anything, this task automatically sets this property to true. The Assert task has a "level" attribute. By default, the level is set to "error", so if the Assert fails, the TestCase fails. If the level is set to "warning", the test case will be marked as a warning rather than a failure. If the level is set to "info" or "debug" and the Assert fails, any message associated with the Assert will be written out, but otherwise will be ignored by TestCase.
</p><p>
To use this task in your build files, include a task definition like this:
</p><pre class="programlisting">
<taskdef name="testcase" classname="ise.antelope.tasks.TestCase"/>
</pre><p>
</p><p>
</p><div class="table"><a name="id2522152"></a><p class="title"><b>Table 26.1. TestCase Attributes</b></p><div class="table-contents"><table summary="TestCase Attributes" border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>file</td><td>The file containing tests.</td><td>None</td><td>Yes</td></tr><tr><td>enabled</td><td>Determines if this test should be ran. By using a property for this attribute, it is easy to turn off/on multiple tests.</td><td>On</td><td>No</td></tr><tr><td>assertenabled</td><td>Generally tests will use the Assert task. This attribute sets whether asserts should be enabled.</td><td>Yes</td><td>No</td></tr><tr><td>failonerror</td><td>If true, cause the build to fail. By default, a failed test does not cause the build to fail, so all tests may have the opportunity to run.</td><td>No</td><td>No</td></tr><tr><td>showoutput</td><td>If true, show intermediate test results</td><td>Yes</td><td>No</td></tr><tr><td>showsummary</td><td>If true, show a summary of test results at the end of the test run.</td><td>Yes</td><td>Yes</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
TestCase is most often used in conjunction with the Suite task.
</p><p>
</p><pre class="programlisting">
<project name="mathtest" basedir="." default="suite"
xmlns:a="antlib:ise.antelope.tasks">
<description>
Build file to run unit tests for the Math task
</description>
<a:suite>
<a:testcase file="math_basic_tests.xml"/>
<a:testcase file="math_rules_tests.xml"/>
<a:testcase file="math_precision_tests.xml"/>
</a:suite>
</project>
</pre><p>
</p><p>
Here is an example build file containing actual tests. The 'setUp' target will execute first, then the two test targets.
</p><p>
</p><pre class="programlisting">
<project name="math_precision_tests" basedir="." default="suite"
xmlns:a="antlib:ise.antelope.tasks">
<target name="setUp">
<echo>Running math precision tests.</echo>
</target>
<target name="test10">
<echo>Circle area test</echo>
<a:math result="pi">
<a:op op="*">
<a:num value="PI"/>
<a:op op="pow">
<a:num value="1"/>
<a:num value="2"/>
</a:op>
</a:op>
</a:math>
<a:assert message="failed circle area test">
<a:bool>
<a:startswith string="${pi}" with="3.141592653589793"/>
</a:bool>
</a:assert>
</target>
<target name="test11">
<echo>Division by zero test</echo>
<!-- division by zero -->
<a:try>
<a:math result="x">
<a:op op="/">
<a:num value="PI"/>
<a:num value="0"/>
</a:op>
</a:math>
<fail>Division by 0 succeeded: ${x}</fail>
<catch>
<assert/>
</catch>
</a:try>
</target>
</project>
</pre><p>
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk03ch25.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk03ch27.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 25. Suite Task </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 27. Performance Monitoring</td></tr></table></div></body></html>
|