You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2005/07/04 16:12:16 UTC

svn commit: r209084 - in /ant/sandbox/antlibs/antunit/trunk: docs/assertions.html src/main/org/apache/ant/antunit/antlib.xml

Author: bodewig
Date: Mon Jul  4 07:12:15 2005
New Revision: 209084

URL: http://svn.apache.org/viewcvs?rev=209084&view=rev
Log:
new assertions for log handling

Modified:
    ant/sandbox/antlibs/antunit/trunk/docs/assertions.html
    ant/sandbox/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/antlib.xml

Modified: ant/sandbox/antlibs/antunit/trunk/docs/assertions.html
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/antunit/trunk/docs/assertions.html?rev=209084&r1=209083&r2=209084&view=diff
==============================================================================
--- ant/sandbox/antlibs/antunit/trunk/docs/assertions.html (original)
+++ ant/sandbox/antlibs/antunit/trunk/docs/assertions.html Mon Jul  4 07:12:15 2005
@@ -447,6 +447,58 @@
       <assertReferenceIsType name="ant.executor" type="org.apache.tools.ant.helper.DefaultExecutor"/>
     </pre>
 
+    <h2><a name="assertLogContains">assertLogContains</a></h2>
+
+    <p>Asserts that the build log contains a given message.</p>
+
+    <p>Only works in the context of an &lt;antunit&gt; task.</p>
+
+    <table border="1" cellpadding="2" cellspacing="0">
+        <tr>
+          <td valign="top"><b>Attribute</b></td>
+          <td valign="top"><b>Description</b></td>
+          <td align="center" valign="top"><b>Required</b></td>
+        </tr>
+        <tr>
+          <td valign="top">text</td>
+          <td valign="top">The text to serach for.</td>
+          <td valign="top" align="center">Yes</td>
+        </tr>
+        <tr>
+          <td valign="top">level</td>
+          <td valign="top">The level the message should have been
+          logged at - the task will also look into more severe
+          levels.  One of "error", "warning", "info", "verbose", "debug".</td>
+          <td valign="top" align="center">No</td>
+        </tr>
+    </table>
+
+    <h2><a name="assertLogDoesntContain">assertLogDoesntContain</a></h2>
+
+    <p>Asserts that the build log doesn't contain a given message.</p>
+
+    <p>Only works in the context of an &lt;antunit&gt; task.</p>
+
+    <table border="1" cellpadding="2" cellspacing="0">
+        <tr>
+          <td valign="top"><b>Attribute</b></td>
+          <td valign="top"><b>Description</b></td>
+          <td align="center" valign="top"><b>Required</b></td>
+        </tr>
+        <tr>
+          <td valign="top">text</td>
+          <td valign="top">The text to serach for.</td>
+          <td valign="top" align="center">Yes</td>
+        </tr>
+        <tr>
+          <td valign="top">level</td>
+          <td valign="top">The level the message should have been
+          logged at - the task will also look into more severe
+          levels.  One of "error", "warning", "info", "verbose", "debug".</td>
+          <td valign="top" align="center">No</td>
+        </tr>
+    </table>
+
     <hr/>
       <p align="center">Copyright &copy; 2005 The Apache Software Foundation. All rights Reserved.</p>
   </body>

Modified: ant/sandbox/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/antlib.xml
URL: http://svn.apache.org/viewcvs/ant/sandbox/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/antlib.xml?rev=209084&r1=209083&r2=209084&view=diff
==============================================================================
--- ant/sandbox/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/antlib.xml (original)
+++ ant/sandbox/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/antlib.xml Mon Jul  4 07:12:15 2005
@@ -174,4 +174,28 @@
     </sequential>
   </macrodef>
 
+  <macrodef name="assertLogContains">
+    <attribute name="text"/>
+    <attribute name="level" default="info"/>
+    <attribute name="message"
+      default="Expected log to contain '@{text}' at level @{level}"/>
+    <sequential>
+      <au:assertTrue message="@{message}">
+        <au:logcontains text="@{text}" level="@{level}"/>
+      </au:assertTrue>
+    </sequential>
+  </macrodef>
+
+  <macrodef name="assertLogDoesntContain">
+    <attribute name="text"/>
+    <attribute name="level" default="info"/>
+    <attribute name="message"
+      default="Unexpected log '@{text}' at level @{level}"/>
+    <sequential>
+      <au:assertFalse message="@{message}">
+        <au:logcontains text="@{text}" level="@{level}"/>
+      </au:assertFalse>
+    </sequential>
+  </macrodef>
+
 </antlib>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org