From f03446d445dabb799ccd25598d470c467a00af15 Mon Sep 17 00:00:00 2001
From: el_kaboing <el_kaboing@localhost>
Date: Thu, 30 Nov 2006 15:18:35 +0000
Subject: [PATCH] Allows the testing of strings in the functional tests.

---
 opendj-sdk/opends/tests/functional-tests/shared/functions/utils.xml |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opends/tests/functional-tests/shared/functions/utils.xml b/opendj-sdk/opends/tests/functional-tests/shared/functions/utils.xml
index 39f14ed..b924840 100755
--- a/opendj-sdk/opends/tests/functional-tests/shared/functions/utils.xml
+++ b/opendj-sdk/opends/tests/functional-tests/shared/functions/utils.xml
@@ -119,6 +119,48 @@
 
   </function>
 
+  <function name="checktestString">
+
+    <function-prolog>
+        This function checks the return string against an expected return substring for a testcase
+    </function-prolog>
+
+    <function-map-args>
+        <function-required-arg name="expectedString">
+            the substring expected from the command
+        </function-required-arg>
+        <function-required-arg name="returnString">
+            the return string received from command
+        </function-required-arg>
+ 
+    </function-map-args>
+
+      <sequence>
+         <script> 
+              import re 
+              searchre = re.compile('%s' % expectedString)
+            </script> 
+  
+            <if expr='re.search(searchre, returnString) != None'>
+              <sequence>
+              <tcstatus result="'pass'"/>
+              <message log="1">
+                'Success: Found substring, %s, in the return string' % (expectedString)
+              </message>
+              </sequence>
+            <else>
+              <sequence>
+              <tcstatus result="'fail'"/>
+              <message log="1" level="'Error'">
+                'Error: Did not find substring, %s, in the return string, %s' % (expectedString, returnString)
+              </message>
+              </sequence>
+            </else>
+            </if>
+      </sequence>
+      
+  </function>
+
   <function name="isAlive">
 
     <function-prolog>

--
Gitblit v1.10.0