Ejemplo n.º 1
0
from globalpkg.mytestlink import TestLink
from globalpkg.othertools import OtherTools

__all__ = [
    'global_headers', 'global_openId', 'global_serial',
    'global_protocol_version', 'global_product_version', 'saofudb', 'testdb',
    'mytestlink', 'other_tools', 'executed_history_id', 'testcase_report_tb',
    'case_step_report_tb', 'global_customer_Id', 'global_shop_Id',
    'global_componentAppId', 'global_appId'
]

# 根据自己的实际需要进行合理的调整
if sys.argv[1] == '1':
    logger.info('当前运行环境:测试环境')
    logger.info('正在初始化数据库[名称:SAOFUDB1]对象')
    saofudb = MyDB('./config/dbconfig.conf', 'SAOFUDB1')
elif sys.argv[1] == '2':
    logger.info('已选择运行环境:预发布环境')
    logger.info('正在初始化数据库[名称:SAOFUDB2]对象')
    saofudb = MyDB('./config/dbconfig.conf', 'SAOFUDB2')

logger.info('正在初始化数据库[名称:TESTDB]对象')
testdb = MyDB('./config/dbconfig.conf', 'TESTDB')

logger.info('正在获取testlink')
mytestlink = TestLink().get_testlink()

other_tools = OtherTools()

executed_history_id = time.strftime('%Y%m%d%H%M%S', time.localtime())  # 流水记录编号
# testcase_report_tb = 'testcase_report_tb' + str(executed_history_id)
Ejemplo n.º 2
0
import sys
import random
import datetime
import string

from globalpkg.log import logger
from globalpkg.mydb import MyDB
#from globalpkg.mytestlink import TestLink
from globalpkg.othertools import OtherTools
from tools import sqls
from tools.gethost import pro

projectname = pro()

logger.info('正在初始化数据库[名称:TESTDB]对象')
testdb = MyDB('./config/dbconfig.conf', 'TESTDB')
#长庆项目库
logger.info('正在初始化数据库[名称:%s]对象', projectname)
testdb_test = MyDB('./config/dbconfig.conf', projectname)

#操作hse_work_ticket表,获取workticketid获取

sql_query_ticket = sqls.ticket
sql_query_ts = sqls.ts
sql_query_worktaskid = sqls.worktaskid
sql_query_worktaskid1 = sqls.worktaskid1
sql_query_work_appoint_id = sqls.appoint_id
sql_query_work_jsaid = sqls.sql_query_work_jsaid
sql_query_work_safeclarid = sqls.sql_query_work_safeclarid
sql_query_work_appointid = sqls.sql_query_work_appointid
logger.info('开始数据库查询')
Ejemplo n.º 3
0
#m

#from globalpkg.log import logger
#from globalpkg.global_var import testdb_test
from tools.gethost import pro
from globalpkg.mydb import MyDB

projectname = pro()
testdb_test = MyDB('./config/dbconfig.conf', projectname)


def sql_query_jsa_step_harm_id():
    sql_query_jsa_step_harm_id = 'SELECT jsa_step_harm_id FROM `hap_hse_clsh`.`hse_safety_analysis_harm` ORDER BY `jsa_step_harm_id` DESC LIMIT 1;'
    hse_work_task = "hse_work_task"
    #logger.info('正在查询jsa_step_harm_id')

    result = testdb_test.select_one_record(sql_query_jsa_step_harm_id)
    jsa_step_harm_id = result[0][0]
    #logger.info("===关闭数据库=============")
    testdb_test.close()
    return jsa_step_harm_id


if __name__ == '__main__':
    sql_query_jsa_step_harm_id()
Ejemplo n.º 4
0
fnow2 = now2.strftime("%Y-%m-%d %H:%M:%S")
now =now.strftime("%Y-%m-%d %H:%M:%S")
'''
'''
# 根据自己的实际需要进行合理的调整
if sys.argv[1] == '1':
    logger.info('当前运行环境:测试环境')
    logger.info('正在初始化数据库[名称:SAOFUDB1]对象')
    saofudb = MyDB('./config/dbconfig.conf', 'SAOFUDB1')
elif sys.argv[1] == '2':
    logger.info('已选择运行环境:预发布环境')
    logger.info('正在初始化数据库[名称:SAOFUDB2]对象')
    saofudb = MyDB('./config/dbconfig.conf', 'SAOFUDB2')
'''
logger.info('正在初始化数据库[名称:TESTDB]对象')
testdb = MyDB('./config/dbconfig.conf', 'TESTDB')
#长庆项目库
logger.info('正在初始化数据库[名称:%s]对象', projectname)
testdb_test = MyDB('./config/dbconfig.conf', projectname)

#操作hse_work_ticket表,获取workticketid获取
sql_query_ticket_1 = sqls.ticket_1
sql_query_ticket = sqls.ticket
sql_query_ts = sqls.ts
sql_query_worktaskid = sqls.worktaskid
sql_query_worktaskid1 = sqls.worktaskid1
sql_query_work_appoint_id = sqls.appoint_id
sql_query_work_jsaid = sqls.sql_query_work_jsaid
sql_query_work_safeclarid = sqls.sql_query_work_safeclarid
sql_query_work_appointid = sqls.sql_query_work_appointid
logger.info('开始数据库查询')
Ejemplo n.º 5
0
from globalpkg.othertools import OtherTools

other_tools = OtherTools()
platform_dir = other_tools.get_platform_dir()

__all__=['global_headers', 'global_openId','global_serial', 'global_protocol_version',
         'global_product_version','saofudb','testdb','mytestlink',
        'other_tools','executed_history_id', 'testcase_report_tb', 'case_step_report_tb']

dbconfig_file_path = platform_dir + '/config/dbconfig.conf'

# 根据自己的实际需要进行合理的调整
if sys.argv[1] == '1':
    logger.info('当前运行环境:测试环境')
    logger.info('正在初始化数据库[名称:TESTDB]对象')
    saofudb = MyDB(dbconfig_file_path, 'TESTDB')
elif sys.argv[1] == '2':
    logger.info('已选择运行环境:预发布环境')
    logger.info('正在初始化数据库[名称:SAOFUDB2]对象')
    saofudb = MyDB(dbconfig_file_path, 'SAOFUDB2')

logger.info('正在初始化数据库[名称:TESTDB]对象')
testdb = MyDB(dbconfig_file_path, 'TESTDB')

logger.info('正在获取testlink')
mytestlink = TestLink().get_testlink()

executed_history_id = time.strftime('%Y%m%d%H%M%S', time.localtime())  # 流水记录编号
# testcase_report_tb = 'testcase_report_tb' + str(executed_history_id)
# case_step_report_tb = 'case_step_report_tb' + str(executed_history_id)
testcase_report_tb = 'testcase_report_tb'
Ejemplo n.º 6
0
fnow2 = now2.strftime("%Y-%m-%d %H:%M:%S")
now =now.strftime("%Y-%m-%d %H:%M:%S")

'''
# 根据自己的实际需要进行合理的调整
if sys.argv[1] == '1':
    logger.info('当前运行环境:测试环境')
    logger.info('正在初始化数据库[名称:SAOFUDB1]对象')
    saofudb = MyDB('./config/dbconfig.conf', 'SAOFUDB1')
elif sys.argv[1] == '2':
    logger.info('已选择运行环境:预发布环境')
    logger.info('正在初始化数据库[名称:SAOFUDB2]对象')
    saofudb = MyDB('./config/dbconfig.conf', 'SAOFUDB2')
'''
logger.info('正在初始化数据库[名称:TESTDB]对象')
testdb = MyDB('./config/dbconfig.conf', 'TESTDB')


#logger.info('正在获取testlink')
#mytestlink = TestLink().get_testlink()


#other_tools = OtherTools()

executed_history_id = time.strftime('%Y%m%d%H%M%S', time.localtime())  # 流水记录编号
# testcase_report_tb = 'testcase_report_tb' + str(executed_history_id)
# case_step_report_tb = 'case_step_report_tb' + str(executed_history_id)
testcase_report_tb = 'testcase_report_tb'
case_step_report_tb = 'case_step_report_tb'
'''
# 请求都携带的公用请求头、请求参数
Ejemplo n.º 7
0
# import datetime
# import string

#from globalpkg.log import logger
from globalpkg.mydb import MyDB
#from globalpkg.mytestlink import TestLink
#from globalpkg.othertools import OtherTools
#from tools import sqls
from tools.gethost import pro
#projectname = pro()

# logger.info('正在初始化数据库[名称:TESTDB]对象')
# testdb = MyDB('./config/dbconfig.conf', 'TESTDB')
# #长庆项目库
# logger.info('正在初始化数据库[名称:%s]对象',projectname)
testdb_test = MyDB('./config/dbconfig.conf', "CHANGLING")


def sql_query_worktaskid(name):
    sql_query_work_appointid = 'SELECT worktaskid from hse_work_task WHERE workname like "name";'
    hse_work_task = "hse_work_task"
    #logger.info('正在查询worktaskid')
    query = 'SELECT worktaskid FROM ' + hse_work_task + ' WHERE workname = %s'
    data = (name)
    result = testdb_test.select_one_record(query, data)
    worktaskid = result[0][0]
    #logger.info("===关闭数据库=============")
    testdb_test.close()
    return worktaskid