[Erp5-report] r26258 - /erp5/trunk/products/ERP5Type/tests/runFunctionalTest.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Apr 2 15:59:56 CEST 2009


Author: kazuhiko
Date: Thu Apr  2 15:59:54 2009
New Revision: 26258

URL: http://svn.erp5.org?rev=26258&view=rev
Log:
add --run_only option to run only 1 specified test suite.

Modified:
    erp5/trunk/products/ERP5Type/tests/runFunctionalTest.py

Modified: erp5/trunk/products/ERP5Type/tests/runFunctionalTest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/runFunctionalTest.py?rev=26258&r1=26257&r2=26258&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/runFunctionalTest.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/runFunctionalTest.py [utf8] Thu Apr  2 15:59:54 2009
@@ -19,7 +19,7 @@
   -h, --help                 this help screen
   --email_to_address=STRING  send results to this address by email (defaults to
                              erp5-report at erp5.org)
-  -s, --stdout               prints the results on stdout instead of sending
+  -s, --stdout               print the results on stdout instead of sending
                              results by email (unless email_to_address is also
                              passed explictly)
   -d, --debug                run firefox on current DISPLAY instead of on Xvfb
@@ -28,6 +28,7 @@
   --portal_name              the ID of the ERP5 site
                              URLs will start with:
                                  http://${host}:${port}/${portal_name}/
+  --run_only=STRING          run only specified test suite (should be only one)
 Notes:
   * You need to prepepare first test environment by using following command:
   ./runUnitTest.py --save prepareFunctionalTest.py                           
@@ -43,6 +44,7 @@
 stdout = 0
 debug = 0
 email_to_address = 'erp5-report at erp5.org'
+run_only=''
 
 tests_framework_home = os.path.dirname(os.path.abspath(__file__))
 # handle 'system global' instance
@@ -75,14 +77,15 @@
   global host
   global port
   global portal_name
+  global run_only
   try:
     opts, args = getopt.getopt(sys.argv[1:],
           "hsd", ["help", "stdout", "debug",
-                 "email_to_address=", "host=", "port=", "portal_name="] )
+                 "email_to_address=", "host=", "port=", "portal_name=", "run_only="] )
   except getopt.GetoptError, msg:
     usage(sys.stderr, msg)
     sys.exit(2)
-  
+
   for opt, arg in opts:
     if opt in ("-s", "--stdout"):
       stdout = 1
@@ -100,6 +103,8 @@
       port = int(arg)
     elif opt == "--portal_name":
       portal_name = arg
+    elif opt == "--run_only":
+      run_only = arg
 
   if not stdout:
     send_mail = 1
@@ -199,6 +204,8 @@
   else:
     # Zelenium 0.8+ or later
     url_string = "http://%s:%d/%s/portal_tests/core/TestRunner.html?test=..%%2Ftest_suite_html&auto=on&__ac_name=%s&__ac_password=%s"
+  if run_only:
+    url_string = url_string.replace('/portal_tests/', '/portal_tests/%s/' % run_only)
   pid = os.spawnlp(os.P_NOWAIT, "firefox", "firefox", "-profile", profile_dir,
       url_string % (host, port, portal_name, user, password))
   os.environ['MOZ_NO_REMOTE'] = '0'
@@ -207,8 +214,8 @@
 
 def getStatus():
   try:
-    status = urllib2.urlopen('http://%s:%d/%s/TestTool_getResults'
-                                % (host, port, portal_name)).read()
+    status = urllib2.urlopen('http://%s:%d/%s/TestTool_getResults?test_zuite_relative_url=%s'
+                                % (host, port, portal_name, run_only)).read()
   except urllib2.HTTPError, e:
     if e.msg == "No Content" :
       status = ""
@@ -227,8 +234,9 @@
                                   (host, port, portal_name, user, password))
 
 def sendResult():
-  result_uri = urllib2.urlopen('http://%s:%d/%s/TestTool_getResults' %
-                                    (host, port, portal_name)).readline()
+  result_uri = urllib2.urlopen('http://%s:%d/%s/TestTool_getResults?test_zuite_relative_url=%s' %
+                                    (host, port, portal_name, run_only)).readline()
+  print result_uri
   file_content = urllib2.urlopen(result_uri).read()
   passes_re = re.compile('<th[^>]*>Tests passed</th>\n\s*<td[^>]*>([^<]*)')
   failures_re = re.compile('<th[^>]*>Tests failed</th>\n\s*<td[^>]*>([^<]*)')




More information about the Erp5-report mailing list