Commit 8f485e41 authored by Julien Muchembled's avatar Julien Muchembled

tests: fix checking of Zuite PT

- Respect run_only/remote_code_url_list if given.
- When page templates have errors, there may be no Zuite Results, in which case
  testFunctionalTestRunner waits forever, until it gets killed (after a few
  hours). It's easier to fix this issue by check PT at the beginning of
  testFunctionalTestRunner, instead of doing it in a separate test method.
parent c9a92f11
...@@ -267,8 +267,6 @@ page.open(address, function (status) { ...@@ -267,8 +267,6 @@ page.open(address, function (status) {
class FunctionalTestRunner: class FunctionalTestRunner:
remote_code_url_list = None
# There is no test that can take more than 6 hours # There is no test that can take more than 6 hours
timeout = 6.0 * 3600 timeout = 6.0 * 3600
...@@ -288,20 +286,9 @@ class FunctionalTestRunner: ...@@ -288,20 +286,9 @@ class FunctionalTestRunner:
def getStatus(self): def getStatus(self):
transaction.begin() transaction.begin()
if self.remote_code_url_list is not None:
# Zuite Results are posted at the root of the portal in this case
return self.portal.portal_tests.TestTool_getResults()
else:
return self.portal.portal_tests.TestTool_getResults(self.run_only) return self.portal.portal_tests.TestTool_getResults(self.run_only)
def _getTestURL(self): def _getTestURL(self):
if self.remote_code_url_list is not None:
remote_code_url = "&".join(["url_list:list=%s" % url for url in self.remote_code_url_list])
if self.run_only != "":
remote_code_url += "&zuite_id=%s" % self.run_only
return '%s/portal_tests/Zuite_runSeleniumTest?%s&resultsUrl=../postResults&__ac_name=%s&__ac_password=%s' \
% (self.portal.portal_url(), remote_code_url, self.user, self.password)
return ZELENIUM_BASE_URL % (self.portal.portal_url(), self.run_only, return ZELENIUM_BASE_URL % (self.portal.portal_url(), self.run_only,
self.user, self.password) self.user, self.password)
...@@ -410,18 +397,24 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase): ...@@ -410,18 +397,24 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
return True return True
return False return False
def testCheckZuitePageTemplatesValidHTML(self): def testFunctionalTestRunner(self):
# Check the zuite page templates can be rendered, because selenium test # Check the zuite page templates can be rendered, because selenium test
# runner does not report error in case there are errors in the page # runner does not report error in case there are errors in the page
# template. # template.
tests_tool = self.portal.portal_tests tests_tool = self.portal.portal_tests
if self.remote_code_url_list:
# This does not really run tests. It initializes a zuite
# and redirect to a url to would actually run them.
tests_tool.Zuite_runSeleniumTest(self.remote_code_url_list, self.run_only)
self.commit()
for page_template_path, page_template in tests_tool.ZopeFind( for page_template_path, page_template in tests_tool.ZopeFind(
tests_tool, obj_metatypes=['Page Template'], search_sub=1): tests_tool[self.run_only] if self.run_only else tests_tool,
obj_metatypes=('Page Template',), search_sub=1):
try: try:
page_template.pt_render() page_template.pt_render()
except (KeyboardInterrupt, SystemExit): except Exception:
raise
except:
exc_type, exc_value, exc_traceback = sys.exc_info() exc_type, exc_value, exc_traceback = sys.exc_info()
self.fail('Rendering of %s failed with error:\n%s' % ( self.fail('Rendering of %s failed with error:\n%s' % (
page_template_path, page_template_path,
...@@ -431,15 +424,9 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase): ...@@ -431,15 +424,9 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
exc_traceback, exc_traceback,
as_html=False)))) as_html=False))))
# abort to get rid of the mysql participation in this transaction
def testFunctionalTestRunner(self):
# first of all, abort to get rid of the mysql participation in this
# transaction
self.portal._p_jar.sync() self.portal._p_jar.sync()
if self.remote_code_url_list is not None:
self.runner.remote_code_url_list = self.remote_code_url_list
debug = self.foreground or os.environ.get("erp5_debug_mode") debug = self.foreground or os.environ.get("erp5_debug_mode")
error = None error = None
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment