From bcf0bb02fd485b0544d53223e6250c3237159067 Mon Sep 17 00:00:00 2001
From: Gary Williams <gary.williams@forgerock.com>
Date: Wed, 04 Apr 2012 13:07:19 +0000
Subject: [PATCH] Add run test suite utility to functional tests

---
 opends/tests/staf-tests/shared/functions/utils.xml |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/opends/tests/staf-tests/shared/functions/utils.xml b/opends/tests/staf-tests/shared/functions/utils.xml
index 2ab9b55..e65dadb 100755
--- a/opends/tests/staf-tests/shared/functions/utils.xml
+++ b/opends/tests/staf-tests/shared/functions/utils.xml
@@ -4223,4 +4223,57 @@
     </sequence>
   </function>
 
+<!-- Run the test suites -->
+  <function name="testSuite_Run">
+    <function-prolog>
+      This function runs the test suites
+    </function-prolog>
+    
+    <function-map-args>
+      <function-arg-def name="suites" type="required">
+        <function-arg-description>
+          List of test suites to run
+        </function-arg-description>
+        <function-arg-property name="type" value="list"/>
+      </function-arg-def>
+      <function-arg-def name="group" type="required">
+        <function-arg-description>
+          Name of test group
+        </function-arg-description>
+        <function-arg-property name="type" value="string"/>
+      </function-arg-def>
+    </function-map-args>
+
+    <sequence>
+      <iterate var="_suite" in="suites" >
+        <try>
+          <sequence>
+            <import machine="STAF_LOCAL_HOSTNAME"
+                    file="'%s/testcases/%s/%s/%s.xml' % 
+                      (TESTS_DIR,group,_suite,_suite)"/>
+            <call function="'%s_%s'% (group,_suite)" />
+          </sequence>
+          
+          <catch exception="'STAFException.TestSuite.SetupException'">
+            <message log="1" level="'fatal'">
+              'Setup of test suite %s failed.' % _suite
+            </message>
+          </catch>
+          
+          <catch exception="'STAFException.TestSuite.MainException'">
+            <message log="1" level="'fatal'">
+              'Main part of test suite %s failed.' % _suite
+            </message>
+          </catch>
+          
+          <catch exception="'STAFException.TestSuite.CleanupException'">
+            <message log="1" level="'fatal'">
+              'Cleanup of test suite %s failed.' % _suite
+            </message>
+          </catch>
+        </try>
+      </iterate>
+    </sequence>
+  </function>
+
 </stax>

--
Gitblit v1.10.0