From: liuct Date: Thu, 14 Aug 2014 11:58:51 +0000 (+0800) Subject: fix webdriver issues X-Git-Tag: upstream/3.1.7~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b72ef1214d9435248216e49f35db4fe9eee1692a;p=test%2Ftools%2Ftestkit-lite.git fix webdriver issues --- diff --git a/packaging/testkit-lite.dsc b/packaging/testkit-lite.dsc index 0003b00..c3bc632 100644 --- a/packaging/testkit-lite.dsc +++ b/packaging/testkit-lite.dsc @@ -7,5 +7,5 @@ Standards-Version: 3.9.2 Homepage: https://github.com/testkit/testkit-manager Version: 3.1.5 Files: - 12ff71e94baf4d76ab7ba89d9e4b3520 1397814 testkit-lite_3.1.5.tar.gz + cb61d7dc17c1c265e90e93227f352b16 1397823 testkit-lite_3.1.5.tar.gz diff --git a/testkitlite/commodule/androidmobile.py b/testkitlite/commodule/androidmobile.py index a9be46c..08e1a30 100644 --- a/testkitlite/commodule/androidmobile.py +++ b/testkitlite/commodule/androidmobile.py @@ -172,7 +172,9 @@ class AndroidMobile: if test_widget is not None and test_widget != "": test_suite = test_widget test_suite = test_suite.replace('-', '_') - test_opt["test_app_id"] = XWALK_APP_STR % (test_suite, test_suite) + tmp_names = test_suite.split('_') + test_activity = ''.join([it.capitalize() for it in tmp_names if it]) + test_opt["test_app_id"] = XWALK_APP_STR % (test_suite, test_activity) else: test_opt["test_app_id"] = test_launcher return test_opt diff --git a/testkitlite/engines/pyunit.py b/testkitlite/engines/pyunit.py index f315f4d..528fd6e 100644 --- a/testkitlite/engines/pyunit.py +++ b/testkitlite/engines/pyunit.py @@ -73,7 +73,7 @@ def _pyunit_test_exec(test_session, test_set_path, result_obj): result_obj.set_status(0) LOGGER.info('[ pyunit test: %s ]' % test_set_path) try: - tests = unittest.TestLoader().discover(test_set_path) + tests = unittest.TestLoader().discover(test_set_path, pattern='*.py') unittest.TextTestRunner(resultclass=LiteTestResult, buffer=True).run(tests) except ImportError as error: pass diff --git a/testkitlite/engines/test_executer.py b/testkitlite/engines/test_executer.py index 9b357e5..7cd3f1b 100644 --- a/testkitlite/engines/test_executer.py +++ b/testkitlite/engines/test_executer.py @@ -85,8 +85,9 @@ class TestExecuter: test_app = '' if self.target_platform.upper().find('ANDROID') >= 0: test_app = self.suite_name.replace('-', '_') - self.TE_LOG.debug( - 'Got ANDROID platform, update the app name to %s' % test_app) + #tmp_names = test_app.split('_') + #test_app = ''.join([it.capitalize() for it in tmp_names if it]) + self.TE_LOG.debug('ANDROID platform, update the app name to %s' % test_app) elif self.target_platform.upper().find('TIZEN') >= 0: test_app = self.appid else: @@ -110,10 +111,11 @@ class TestExecuter: def __talkWithRunnerRecv(self): try: exe_data = self.exe_socket.recv(self.exe_socket_buff_size) + if exe_data is None: + return (None, None) exe_json = json.loads(exe_data) command = exe_json['COMMAND'] data = exe_json['DATA'] - self.TE_LOG.debug('Receive Data: %s' % exe_json) except Exception, e: self.TE_LOG.debug('Receive data failed, %s' % e) time.sleep(2) @@ -122,7 +124,6 @@ class TestExecuter: def __talkWithRunnerSend(self, data=None): try: - self.TE_LOG.debug('Send Data: %s' % data) self.exe_socket.send(json.dumps(data)) except Exception, e: self.TE_LOG.debug('Send data failed, %s' % e) @@ -203,8 +204,6 @@ class TestExecuter: "document.getElementById(\"case-info-area\").className = \"READY\"") if i_case_status in [STR_PASS, STR_FAIL, STR_BLOCK]: self.tests_json['cases'][i_case]['result'] = i_case_status - self.TE_LOG.info("Cases %s: %s" % (self.tests_json['cases'][i_case][ - 'case_id'], self.tests_json['cases'][i_case]['result'])) i_case = i_case + 1 elif i_case_status == "FORWARD": i_case = i_case + 1 @@ -240,8 +239,6 @@ class TestExecuter: "%Y-%m-%d %H:%M:%S", time.localtime()) try: i_case_timeout = i_case['timeout'] - self.TE_LOG.debug( - "Using special timeout value: %s" % i_case_timeout) except Exception, e: i_case_timeout = DEFAULT_TIMEOUT @@ -320,9 +317,6 @@ class TestExecuter: else: i_case['result'] = STR_FAIL - self.TE_LOG.info("Cases %s: %s" % - (i_case['case_id'], i_case['result'])) - def __getCaseIndex(self, url): try: value_pos = url.index('value') @@ -376,8 +370,6 @@ class TestExecuter: element_index - 1]['entry'] url_equal = self.__checkUrlSame(pre_url, i_case['entry']) i_case_timeout = i_case['timeout'] - self.TE_LOG.debug( - "Using special timeout value: %s" % i_case_timeout) except Exception, e: i_case_timeout = DEFAULT_TIMEOUT @@ -440,8 +432,6 @@ class TestExecuter: return False try: i_case_timeout = int(i_case['timeout']) - self.TE_LOG.debug( - "Using special timeout value: %s" % i_case_timeout) except Exception, e: i_case_timeout = DEFAULT_TIMEOUT @@ -466,8 +456,6 @@ class TestExecuter: i_case['result'] = STR_FAIL break time.sleep(1) - self.TE_LOG.info("Cases %s: %s" % - (i_case['case_id'], i_case['result'])) except Exception, e: i_case['result'] = STR_BLOCK self.TE_LOG.error( diff --git a/testkitlite/engines/webdriver.py b/testkitlite/engines/webdriver.py index a07600b..bb7268a 100644 --- a/testkitlite/engines/webdriver.py +++ b/testkitlite/engines/webdriver.py @@ -67,6 +67,8 @@ def _run_webdrvier_test(self, cases, result_obj): else: end = idx * self.opts['block_size'] block_data = cases[start:end] + for tc in block_data: + tc.pop('purpose') test_set_queues.append({'cases': block_data}) idx += 1 @@ -77,8 +79,7 @@ def _run_webdrvier_test(self, cases, result_obj): for section_json in test_set_queues: if result_obj.get_status() == 1: break - LOGGER.info("Loading a new section for testing ...") - time.sleep(EXECUTER_POLLING_INTERVAL) + LOGGER.info("Load a new section for testing, please wait ...") get_result = False while True: if result_obj.get_status() == 1: @@ -95,6 +96,7 @@ def _run_webdrvier_test(self, cases, result_obj): break continue elif exe_data == 'RUNNING': + time.sleep(EXECUTER_POLLING_INTERVAL) continue elif exe_data == 'DONE': exe_command, exe_data = self.talkWithEXE( @@ -114,7 +116,8 @@ def _run_webdrvier_test(self, cases, result_obj): break if abort_from_set: LOGGER.error('Exit from current set execution') - break + return + ### normally exit result_obj.set_status(1) exe_command, exe_data = self.talkWithEXE( 'TERMINAL', '', 1) @@ -129,7 +132,7 @@ class TestWorker(object): self.conn = conn self.server_url = None self.result_obj = None - self.opts = dict({'block_size': 20, + self.opts = dict({'block_size': 10, 'test_type': None, 'exe_socket_buff_size': 20480, 'runner_proc': os.getpid(), @@ -254,6 +257,8 @@ class TestWorker(object): json.dumps({'COMMAND': command, 'DATA': data})) exe_data = self.exe_socket_connect.recv( self.opts['exe_socket_buff_size']) + if not exe_data: + return (None, None) exe_json = json.loads(exe_data) if exe_json['COMMAND']: command = exe_json['COMMAND'] diff --git a/testkitlite/util/log.py b/testkitlite/util/log.py index 648c342..fe98dbd 100644 --- a/testkitlite/util/log.py +++ b/testkitlite/util/log.py @@ -41,6 +41,7 @@ class Logger: def __init__(self, level="DEBUG", format_str="%(message)s"): """Generate root logger""" self._logger = logging.getLogger("TCT") + self._level = LEVELS[level] self._logger.setLevel(LEVELS[level]) self._formatter = logging.Formatter(format_str) self.add_print_logger()