mailr13217 - /branches/gui_testing/test_suite/test_suite_runner.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on June 24, 2011 - 12:20:
Author: bugman
Date: Fri Jun 24 12:20:17 2011
New Revision: 13217

URL: http://svn.gna.org/viewcvs/relax?rev=13217&view=rev
Log:
The GUI test framework has been added to the relax test suite runner.


Modified:
    branches/gui_testing/test_suite/test_suite_runner.py

Modified: branches/gui_testing/test_suite/test_suite_runner.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/test_suite/test_suite_runner.py?rev=13217&r1=13216&r2=13217&view=diff
==============================================================================
--- branches/gui_testing/test_suite/test_suite_runner.py (original)
+++ branches/gui_testing/test_suite/test_suite_runner.py Fri Jun 24 12:20:17 
2011
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2006-2010 Edward d'Auvergne                                  
 #
+# Copyright (C) 2006-2011 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -28,6 +28,7 @@
 from formatting import subtitle, summary_line, title
 
 # Import the test suite categories.
+from gui_tests import GUI_test_runner
 from system_tests import System_test_runner
 from unit_tests.unit_test_runner import Unit_test_runner
 
@@ -42,6 +43,7 @@
     This currently includes the following categories of tests:
         - System/functional tests.
         - Unit tests.
+        - GUI tests.
     """
 
     def __init__(self, tests=None):
@@ -71,8 +73,30 @@
         # Execute the unit tests.
         self.run_unit_tests(summary=False)
 
+        # Execute the GUI tests.
+        self.run_gui_tests(summary=False)
+
         # Print out a summary of the test suite.
         self.summary()
+
+
+    def run_gui_tests(self, summary=True):
+        """Execute the GUI tests.
+
+        @keyword summary:   A flag which if True will cause a summary to be 
printed.
+        @type summary:      bool
+        """
+
+        # Print a header.
+        title('GUI tests')
+
+        # Run the tests.
+        gui_runner = GUI_test_runner()
+        self.gui_result = gui_runner.run(self.tests)
+
+        # Print out a summary of the test suite.
+        if summary:
+            self.summary()
 
 
     def run_system_tests(self, summary=True):
@@ -133,9 +157,13 @@
         if hasattr(self, 'unit_result'):
             summary_line("Unit tests", self.unit_result)
 
+        # GUI test summary.
+        if hasattr(self, 'gui_result'):
+            summary_line("GUI tests", self.gui_result)
+
         # Synopsis.
-        if hasattr(self, 'system_result') and hasattr(self, 'unit_result'):
-            summary_line("Synopsis", self.system_result and self.unit_result)
+        if hasattr(self, 'system_result') and hasattr(self, 'unit_result') 
and hasattr(self, 'gui_result'):
+            summary_line("Synopsis", self.system_result and self.unit_result 
and self.gui_result)
 
         # End.
         print('\n\n')
@@ -147,6 +175,7 @@
         # Counts.
         system_count = {}
         unit_count = {}
+        gui_count = {}
         for i in range(len(status.skipped_tests)):
             # Alias.
             test = status.skipped_tests[i]
@@ -155,6 +184,7 @@
             if not system_count.has_key(test[1]):
                 system_count[test[1]] = 0
                 unit_count[test[1]] = 0
+                gui_count[test[1]] = 0
 
             # A system test.
             if test[2] == 'system':
@@ -163,6 +193,10 @@
             # A unit test.
             if test[2] == 'unit':
                 unit_count[test[1]] += 1
+
+            # A GUI test.
+            if test[2] == 'gui':
+                gui_count[test[1]] += 1
 
         # The missing modules.
         missing_modules = sorted(system_count.keys())
@@ -176,32 +210,30 @@
             # The skip the table.
             return
 
-        # The formatting string.
-        if hasattr(self, 'system_result') and hasattr(self, 'unit_result'):
-            format = "%-30s %20s %20s"
-        else:
-            format = "%-30s %20s"
-
         # Header.
         print("Tests skipped due to missing packages/modules:\n")
-        if hasattr(self, 'system_result') and hasattr(self, 'unit_result'):
-            header = format % ("Module", "System test count", "Unit test 
count")
-        elif hasattr(self, 'system_result'):
-            header = format % ("Module", "System test count")
-        else:
-            header = format % ("Module", "Unit test count")
+        header = "%-30s" % "Module" 
+        if hasattr(self, 'system_result'):
+            header = "%s %20s" % (header, "System test count")
+        if hasattr(self, 'unit_result'):
+            header = "%s %20s" % (header, "Unit test count")
+        if hasattr(self, 'gui_result'):
+            header = "%s %20s" % (header, "GUI test count")
         print('-'*len(header))
         print(header)
         print('-'*len(header))
 
         # The table.
         for module in missing_modules:
-            if hasattr(self, 'system_result') and hasattr(self, 
'unit_result'):
-                print(format % (module, system_count[module], 
unit_count[module]))
-            elif hasattr(self, 'system_result'):
-                print(format % (module, system_count[module]))
-            else:
-                print(format % (module, unit_count[module]))
+            text = "%-30s" % module
+            if hasattr(self, 'system_result'):
+                text = "%s %20s" % (text, system_count[module])
+            if hasattr(self, 'unit_result'):
+                text = "%s %20s" % (text, unit_count[module])
+            if hasattr(self, 'gui_result'):
+                text = "%s %20s" % (text, gui_count[module])
+            print(text)
+
 
         # End the table.
         print('-'*len(header))




Related Messages


Powered by MHonArc, Updated Fri Jun 24 13:00:02 2011