1.优化 atx 步骤组织

2.独立出 atx 用例执行任务,和原 core 并行
This commit is contained in:
jerrylizilong 2018-11-16 10:22:37 +08:00
parent 02d8c16cd3
commit 3e5cf7dcb7
5 changed files with 52 additions and 5 deletions

View File

@ -0,0 +1,38 @@
import time
from app.core import process, log
from app.db import test_task_manage
def main():
idList = test_task_manage.test_task_manage().test_suite_list(runtype='0')
idList1 = test_task_manage.test_task_manage().test_case_list(isATX=True)
if len(idList):
for caselist in idList:
test_suite_id = caselist[0]
runType = str(caselist[1])
if runType =='0' or runType =='Android':
threadNum = 1
runType ='Android'
process.process().runmain(test_suite_id, threadNum, runType)
result1 = 0
else:
result1=1
if len(idList1):
threadNum = 1
process.process().multipleRun(idList1, threadNum)
result2 = 0
else:
result2=1
result = result1 +result2
return result
def coreservice():
while (1):
if(main()):
time.sleep(6)
coreservice()

View File

@ -1,13 +1,16 @@
from app import useDB
from app.db import test_batch_manage
class test_task_manage():
def test_suite_list(self):
sql = 'select id,run_type from test_suite where status in (0,2);'
def test_suite_list(self,runtype='2'):
sql = 'select id,run_type from test_suite where status in (0,2) and run_type = "%s";' %runtype
idList = useDB.useDB().search(sql)
return idList
def test_case_list(self):
sql = 'select id, steps,browser_type from test_batch where status in (0) and test_suite_id = 0;'
def test_case_list(self,isATX=False):
if isATX:
sql = 'select t1.id, t1.steps,t1.browser_type from test_batch t1, test_case t2 where t1.status in (0) and t1.test_suite_id = 0 and t1.test_case_id=t2.id and t2.module="android";'
else:
sql = 'select t1.id, t1.steps,t1.browser_type from test_batch t1, test_case t2 where t1.status in (0) and t1.test_suite_id = 0 and t1.test_case_id=t2.id and t2.module !="android";'
idList = useDB.useDB().search(sql)
return idList

View File

@ -52,7 +52,8 @@ class mysqlDB(object):
def connect(self):
# change root password to yours:
import mysql.connector
conn = mysql.connector.connect(host=config.db_host, port=config.db_port, user=config.db_user, password=config.db_password, database=config.database)
conn = mysql.connector.connect(host=config.db_host, port=config.db_port, user=config.db_user, password=config.db_password, database=config.database,
auth_plugin='mysql_native_password')
return conn
def search(self, sql):

3
atxcore.py Normal file
View File

@ -0,0 +1,3 @@
from app.core import atx_coreservice
atx_coreservice.coreservice()

View File

@ -21,8 +21,10 @@ pyecharts==0.5.5
pyecharts-javascripthon==0.0.6
pyecharts-jupyter-installer==0.0.3
requests==2.19.1
retrying==1.3.3
selenium==3.13.0
six==1.11.0
urllib3==1.23
visitor==0.1.3
Werkzeug==0.14.1
uiautomator2==0.0.3