import xml.etree.ElementTree as etree
from optparse import OptionParser, make_option
from datetime import datetime
+import json
try:
elif OPTIONS.bmanualonly:
exec_types.remove("auto")
- 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"
sys.exit(1)
device_id = CONNECTOR.get_device_info()['device_id']
+ os.environ['DEVICE_ID'] = device_id
if not OPTIONS.non_active:
device_locked = get_device_lock(device_id)
if not device_locked:
LOGGER.error("[ Error: Failed to get device for current session... ]\n")
sys.exit(1)
+ # load profile for wedrvier
+ if OPTIONS.targetplatform:
+ webdriver_vars = {}
+ exec 'from testkitlite.capability.%s import initCapability' % OPTIONS.targetplatform
+ if OPTIONS.targetplatform.upper().find('TIZEN') >= 0:
+ if not OPTIONS.debugip:
+ raise ValueError("tizen xwalk need a debugip value!")
+ webdriver_vars = initCapability('TEST_APP_ID', OPTIONS.debugip)
+ elif OPTIONS.targetplatform.upper().find('ANDROID') >= 0:
+ webdriver_vars = initCapability('TEST_APP_NAME')
+ else:
+ webdriver_vars = initCapability()
+ os.environ['WEBDRIVER_VARS'] = json.dumps(webdriver_vars)
+
+ # load test defintion files
if "device:" in OPTIONS.testxml[0]:
if not CONNECTOR.is_support_remote():
raise ValueError("For '%s' mode, please test file without prefix 'device:' " % conn_opt['commodule'])
break
OPTIONS.testxml = LOCAL_TESTLISTS
+
# load test engine
workername = OPTIONS.worker or 'default'
try:
-def initCapability(test_app_name=None, appid=None):
+def initCapability(test_app=None, debug_ip=None):
capability = {'chrome.binary': '/usr/bin/chromium-browser'}
- return {'desired_capabilities': capability, 'test_prefix': 'file:///'}
+ return {'webdriver_url': 'http://127.0.0.1:9515', 'desired_capabilities': capability, 'test_prefix': 'file:///'}
-def initCapability(test_app_name=None, appid=None):
+def initCapability(test_app=None, debug_ip=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/'}
+ test_app, 'androidActivity': '.%sActivity' % test_app}}
+ return {'webdriver_url': 'http://127.0.0.1:9515', 'desired_capabilities': capability, 'test_prefix': 'file:///android_asset/www/'}
-def initCapability(test_app_name=None, appid=None):
- capability = {'xwalkOptions': {'tizenDebuggerAddress': test_app_name, 'tizenAppId': appid}}
- return {'desired_capabilities': capability, 'test_prefix': ''}
+def initCapability(test_app=None, debug_ip=None):
+ capability = {'xwalkOptions': {'tizenDebuggerAddress': debug_ip, 'tizenAppId': test_app}}
+ return {'webdriver_url': 'http://127.0.0.1:9515', 'desired_capabilities': capability, 'test_prefix': ''}
from testkitlite.util.errors import InvalidDeviceException
+os.environ['TEST_PLATFORM'] = 'android'
+os.environ['CONNECT_TYPE'] = 'adb'
LOCAL_HOST_NS = "127.0.0.1"
APP_QUERY_STR = "adb -s %s shell ps | grep %s | awk '{print $2}' "
APK_INSTALL = "adb -s %s shell pm install %s"
HOST_NS = "127.0.0.1"
os.environ['no_proxy'] = HOST_NS
+os.environ['TEST_PLATFORM'] = 'localhost'
+os.environ['CONNECT_TYPE'] = 'local'
APP_QUERY_STR = "ps aux | grep %s | grep -v grep"
HOST_NS = "127.0.0.1"
os.environ['no_proxy'] = HOST_NS
+os.environ['TEST_PLATFORM'] = 'tizen'
+os.environ['CONNECT_TYPE'] = 'ssh'
# common constants
RPM_INSTALL = "ssh %s rpm -ivh %s"
HOST_NS = "127.0.0.1"
os.environ['no_proxy'] = HOST_NS
+os.environ['TEST_PLATFORM'] = 'tizen'
+os.environ['CONNECT_TYPE'] = 'local'
RPM_INSTALL = "rpm -ivh %s"
RPM_UNINSTALL = "rpm -e %s"
RPM_LIST = "rpm -qa | grep tct | grep -v grep"
from testkitlite.util.killall import killall
from testkitlite.util.errors import InvalidDeviceException
-
+os.environ['TEST_PLATFORM'] = 'tizen'
+os.environ['CONNECT_TYPE'] = 'sdb'
LOCAL_HOST_NS = "127.0.0.1"
BUILD_INFO_FILE = '/opt/usr/media/Documents/tct/buildinfo.xml'
RPM_INSTALL = "sdb -s %s shell rpm -ivh %s"
if self.wd_url == '':
self.wd_url = DEFAULT_WD_URL
- test_app_name = ''
+ test_app = ''
appis = ''
if self.target_platform.upper().find('ANDROID') >= 0:
- test_app_name = self.suite_name.replace('-', '_')
+ test_app = 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
+ test_app = self.appid
else:
- test_app_name = self.suite_name
+ test_app = self.suite_name
exec 'from testkitlite.capability.%s import initCapability' % self.target_platform
- driver_env = initCapability(test_app_name, self.appid)
+ driver_env = initCapability(test_app, self.debugip)
self.test_prefix = driver_env['test_prefix']
self.web_driver = WebDriver(
self.wd_url, driver_env['desired_capabilities'])
#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['appid'] = _opts.get("test_app_id", '') if _opts else ''
self.opts['debugip'] = params.get("debugip", '')
if not self.__exitExecuter():
else:
timecnt += 1
if not blaunched:
- LOGGER.info("[ launch stub process failed! ]")
+ LOGGER.info("[ launch webdriver failed! ]")
return None
else:
return str(uuid.uuid1())
command = exe_json['COMMAND']
if exe_json['DATA']:
data = exe_json['DATA']
- LOGGER.debug('Got: %s, %s' % (command, data))
except Exception, e:
LOGGER.error('Talk with executer failed: %s, kill executer' % e)
self.__exitExecuter()