help="check if rerun test mode"),
make_option("--non-active", dest="non_active", action="store_true",
help="Disable the ability to set the result of \
- core manual cases from the console")
+ core manual cases from the console"),
+ make_option("-d", "--debugip", dest="debugip", action="store",
+ help="specify tizen xwalk debug ip ")
]
elif OPTIONS.bmanualonly:
exec_types.remove("auto")
- #connector options
+ if OPTIONS.targetplatform and OPTIONS.targetplatform.upper().find('TIZEN') >= 0:
+ if not OPTIONS.debugip:
+ raise ValueError("tizen xwalk need a debugip input")
+
+ # connector options
conn_opt = {}
conn_opt['commodule'] = OPTIONS.commodule or "tizenmobile"
conn_opt['deviceid'] = OPTIONS.device_serial
-def initCapability(test_app_name=None):
+def initCapability(test_app_name=None, appid=None):
capability = {'chrome.binary': '/usr/bin/chromium-browser'}
return {'desired_capabilities': capability, 'test_prefix': 'file:///'}
-def initCapability(test_app_name=None):
+def initCapability(test_app_name=None, appid=None):
capability = {'xwalkOptions': {'androidPackage': 'org.xwalk.%s' %
test_app_name, 'androidActivity': '.%sActivity' % test_app_name}}
return {'desired_capabilities': capability, 'test_prefix': 'file:///android_asset/www/'}
--- /dev/null
+def initCapability(test_app_name=None, appid=None):
+ capability = {'xwalkOptions': {'tizenDebuggerAddress': test_app_name, 'tizenAppId': appid}}
+ return {'desired_capabilities': capability, 'test_prefix': ''}
if params.get('test-launcher') is not None:
self.opts['test_type'] = "webapi"
return self.__init_webtest_opt(params)
+ elif params.get('set_type') in ['ref','js']:
+ self.opts['test_type'] = "webapi"
+ params['test-launcher'] = "xwalk"
+ return self.__init_webtest_opt(params)
else:
self.opts['test_type'] = "coreapi"
return str(uuid.uuid1())
+
def __run_core_test(self, sessionid, test_set_name, exetype, cases):
"""
process the execution for core api test
self.result_obj = TestSetResut(
self.opts['testsuite_name'], self.opts['testset_name'])
if self.opts['test_type'] == "webapi":
+ if ctype == 'ref':
+ exetype = 'manual'
return self.__run_web_test(sessionid, self.opts['testset_name'], exetype, ctype, cases)
elif self.opts['test_type'] == "coreapi":
return self.__run_core_test(sessionid, self.opts['testset_name'], exetype, cases)
self.TE_LOG.addHandler(stream_handler)
signal.signal(signal.SIGINT, self.__exitHandler)
signal.signal(signal.SIGTERM, self.__exitHandler)
+ #for tizne xw
+ self.debugip = test_env.get("debugip", '')
+ self.appid = test_env.get("appid", '')
def __exitHandler(self, a, b):
if self.web_driver:
self.wd_url = DEFAULT_WD_URL
test_app_name = ''
+ appis = ''
if self.target_platform.upper().find('ANDROID') >= 0:
test_app_name = self.suite_name.replace('-', '_')
self.TE_LOG.debug(
'Got ANDROID platform, update the app name to %s' % test_app_name)
+ elif self.target_platform.upper().find('TIZEN') >= 0:
+ test_app_name = self.debugip
else:
-
test_app_name = self.suite_name
exec 'from testkitlite.capability.%s import initCapability' % self.target_platform
- driver_env = initCapability(test_app_name)
+ driver_env = initCapability(test_app_name, self.appid)
self.test_prefix = driver_env['test_prefix']
self.web_driver = WebDriver(
self.wd_url, driver_env['desired_capabilities'])
import os
import time
import sys
-import logging
import json
import socket
import shutil
from testkitlite.util.log import LOGGER
from testkitlite.util.result import TestSetResut
-LOG = logging.getLogger("TestWorker")
EXECUTER_POLLING_INTERVAL = 2
CNT_RETRY = 10
for section_json in test_set_queues:
if result_obj.get_status() == 1:
break
- LOG.info("Loading a new section for testing ...")
+ LOGGER.info("Loading a new section for testing ...")
time.sleep(EXECUTER_POLLING_INTERVAL)
get_result = False
while True:
exe_command, exe_data = self.talkWithEXE(
'TESTS', {'data': section_json}, 0)
if exe_command != 'TESTS' or exe_data != 'OK':
- LOG.debug('Send tests failed')
+ LOGGER.debug('Send tests failed')
result_obj.set_status(1)
break
continue
get_result = True
break
elif exe_data == 'ERROR':
- LOG.error('Executer got error')
+ LOGGER.error('Executer got error')
get_result = True
result_obj.set_status(1)
break
result_obj.set_status(1)
break
if abort_from_set:
- LOG.error('Exit from current set execution')
+ LOGGER.error('Exit from current set execution')
break
result_obj.set_status(1)
exe_command, exe_data = self.talkWithEXE(
self.opts['session_dir'] = params.get("session_dir", '')
self.opts['log_debug'] = params.get("log_debug", '')
self.opts['exe_socket_file'] = self.exe_socket_file
+ #get tizen xw IP and appid
+ if self.opts['target_platform'].upper().find('TIZEN') >= 0:
+ _opts = self.conn.get_launcher_opt('xwalk', None, None, self.opts['suite_name'], self.opts['testset_name'])
+ self.opts['appid'] = _opts.get("test_app_id", '')
+ self.opts['debugip'] = params.get("debugip", '')
if not self.__exitExecuter():
- LOG.debug('__exitExecuter failed')
+ LOGGER.debug('__exitExecuter failed')
return None
if self.__initExecuterSocket():
time.sleep(EXECUTER_POLLING_INTERVAL)
if (not self.exe_proc) or (not tr_utils.pidExists(self.exe_proc)):
- LOG.debug('Executer not existing')
+ LOGGER.debug('Executer not existing')
return None
else:
timecnt = 0
sys.exit(0)
else:
self.exe_proc = new_proc
- LOG.debug('Runner Proc: %s, Executer Proc: %s' %
+ LOGGER.debug('Runner Proc: %s, Executer Proc: %s' %
(self.runner_proc, self.exe_proc))
return True
except OSError, e:
self.exe_socket.bind(self.exe_socket_file)
self.exe_socket.listen(1)
except Exception, e:
- LOG.error('Setup socket failed')
+ LOGGER.error('Setup socket failed')
return False
if not self.__initExecuter():
- LOG.error('Init Executer failed')
+ LOGGER.error('Init Executer failed')
if self.exe_proc and tr_utils.pidExists(self.exe_proc):
killProcGroup(self.exe_proc)
self.exe_proc = None
return True
def talkWithEXE(self, command=None, data=None, recv_timeout=None):
- LOG.debug('Start send: %s, %s' % (command, data))
+ # LOGGER.debug('Start send: %s, %s' % (command, data))
try:
self.exe_socket.settimeout(recv_timeout)
self.exe_socket_connect.send(
command = exe_json['COMMAND']
if exe_json['DATA']:
data = exe_json['DATA']
- LOG.debug('Got: %s, %s' % (command, data))
+ LOGGER.debug('Got: %s, %s' % (command, data))
except Exception, e:
- LOG.error('Talk with executer failed: %s, kill executer' % e)
+ LOGGER.error('Talk with executer failed: %s, kill executer' % e)
self.__exitExecuter()
return (None, None)
self.rerun = False
self.test_prefix = ""
self.filter_ok = False
- self.targetplatform = None
self.wdurl = ""
+ self.debugip = ""
+ self.targetplatform = ""
def set_global_parameters(self, options):
"get all options "
self.targetplatform = options.targetplatform
if options.wdurl:
self.wdurl = options.wdurl
+ if options.debugip:
+ self.debugip = options.debugip
def add_filter_rules(self, **kargs):
"""
starup_parameters[OPT_CAPABILITY] = self.capabilities
# for webdriver
starup_parameters['target_platform'] = self.targetplatform
+ starup_parameters['debugip'] = self.debugip
starup_parameters['wd_url'] = self.wdurl
starup_parameters['set_type'] = self.set_parameters['type']
starup_parameters['set_exetype'] = self.set_parameters['exetype']