Ejemplo n.º 1
0
 def __init__(self):
     GetLog = Log('basecode')
     self.getlog = GetLog.log()
     LOCALCONFIG = operationConfig.CONFIG()
     pro_dir = operationConfig.RROJECT_DIR
     excel_dir = os.path.join(
         pro_dir, LOCALCONFIG.get_config_value('EXCEL', 'excel_file'))
     self.baseexcel = BaseExcel(excel_dir)
     self.dict_key_value = eval(
         LOCALCONFIG.get_config_value('EXCEL', 'excel_case_name'))
     self.getlog.info('案例key值读取成功为:{0}'.format(self.dict_key_value))
Ejemplo n.º 2
0
 def __init__(self,path):
     '''
     找到要打开的excel表格,并打开
     :param path:
     '''
     self.path=path
     GetLog = Log('baseExcel')
     self.getlog = GetLog.log()
     try:
         self.workbook=xlrd.open_workbook(self.path)
         self.getlog.info('打开Excel成功')
     except BaseException as e:
         self.getlog.error('打开Excel报错了: %s' % e)
Ejemplo n.º 3
0
class BaseHttp():
    GetLog = Log('basehttp')
    getlog = GetLog.log()
    getconfig = operationConfig.CONFIG()
    scheme = getconfig.get_config_value('HTTP', 'scheme')
    baseurl = getconfig.get_config_value('HTTP', 'baseurl')
    port = getconfig.get_config_value('HTTP', 'port')
    timeout = getconfig.get_config_value('HTTP', 'timeout')
    if port:
        baseurl = scheme + '://' + baseurl + ':' + port
    else:
        baseurl = scheme + '://' + baseurl
    getlog.info('读取url成功:{0}'.format(baseurl))

    def get(self, uri, params):
        headers = {'Content-type': 'application/x-www-form-urlencoded'}
        url = self.baseurl + uri
        self.getlog.info('最终拼接地址为:{0}'.format(url))
        try:
            response = requests.get(url, headers=headers, params=params)
            self.getlog.info('get请求成功,内容为:%s' % response.content)
            return response

        except TimeoutError as e:
            self.getlog.error('get请求报错了,报错为:%s' % e)

    def post(self, uri, data):
        headers = {'Content-type': 'application/x-www-form-urlencoded'}
        url = self.baseurl + uri
        self.getlog.info('最终拼接地址为:{0}'.format(url))
        try:
            response = requests.post(url,
                                     headers=headers,
                                     data=data,
                                     timeout=int(self.timeout))
            self.getlog.info('post请求成功,内容为:%s' % response.text)
            if response.status_code == 200:
                self.getlog.info('post请求成功')
            else:
                self.getlog.info('post请求返回失败')
            return response

        except TimeoutError as e:
            self.getlog.error('post请求报错了,报错为:%s' % e)

    def post_with_json(self, uri, data):
        headers = {'Content-type': 'application/json'}
        url = self.baseurl + uri
        try:
            response = requests.post(url,
                                     headers=headers,
                                     json=data,
                                     timeout=int(self.timeout))
            self.getlog.info('post_with_json请求成功,内容为:%s' % response.text)
            return response

        except TimeoutError as e:
            self.getlog.error('post_with_json请求报错了,报错为:%s' % e)
Ejemplo n.º 4
0
class BaseHttp():
    '''
    封装get post post_with_json 三种方式,用于获取response
    '''
    GetLog = Log('basehttp')
    getlog = GetLog.log()
    getconfig = CONFIG()
    scheme = getconfig.get_config_value('HTTP', 'scheme')
    baseurl = getconfig.get_config_value('HTTP', 'baseurl')
    port = getconfig.get_config_value('HTTP', 'port')
    timeout = getconfig.get_config_value('HTTP', 'timeout')
    if port:
        baseurl = scheme + ':' + '//' + baseurl + ':' + port
        getlog.info('有端口号拼接地址为:{0}'.format(baseurl))
    else:
        baseurl = scheme + ':' + '//' + baseurl
        getlog.info('无端口号拼接地址为:{0}'.format(baseurl))

    def get(self, uri, params):
        headers = {'Content-type': 'application/x-www-form-urlencoded'}
        url = self.baseurl + uri
        self.getlog.info('最终拼接地址为:{0}'.format(url))
        try:
            response = requests.get(headers=headers, url=url, params=params)
            self.getlog.info('get请求成功,返回结果为:{0}'.format(response))

        except TimeoutError as e:
            self.getlog.erro('get请求失败,报错为:{0}'.format(e))
        return response

    def post(self, uri, params):
        headers = {'Content-type': 'application/x-www-form-urlencoded'}
        url = self.baseurl + uri
        self.getlog.info('最终拼接地址为:{0}'.format(url))
        try:
            response = requests.post(headers=headers,
                                     url=url,
                                     params=params,
                                     timeout=int(self.timeout))
            self.getlog.info('post请求成功,返回结果为:{0}'.format(response))

        except TimeoutError as e:
            self.getlog.erro('post请求失败,报错为:{0}'.format(e))
        return response

    def post_with_json(self, uri, params):
        headers = {'Content-type': 'application/json'}
        url = self.baseurl + uri
        self.getlog.info('最终拼接地址为:{0}'.format(url))
        try:
            response = requests.post(headers=headers, url=url, json=params)
            self.getlog.info('post_with_json请求成功,返回结果为:{0}'.format(response))

        except TimeoutError as e:
            self.getlog.erro('post_with_json请求失败,报错为:{0}'.format(e))
        return response
Ejemplo n.º 5
0
 def docs(self,data):
     driver = self.base_driver
     # 休眠等待
     driver.sleep(1)
     log = Log('..\\logs')
     # 点击文档
     log.info('点击文档')
     driver.click(self.DOCS_WEND)
     driver.sleep(1)
     # 点击创建文档库
     log.info('点击创建文档库')
     driver.switch_to_frame(self.DOCS_FRAME)
     driver.sleep(1)
     driver.click(self.DOCS_JIAN)
     # 编辑文档库类型
     log.info('编辑文档库类型')
     driver.select_by_visible_text(self.DOCS_KULX, data['libtype'])
     driver.sleep(1)
     if data['libtype'] == '自定义文档库':
         # 编辑文档库名称
         log.info('编辑文档库名称')
         driver.click(self.DOCS_MZI)
         driver.type1(self.DOCS_MZI,data['name'])
         driver.sleep(1)
         # 编辑文档库授权用户
         log.info('编辑文档库授权用户')
         driver.click(self.DOCS_SHOUQ)
         driver.type1(self.DOCS_SHOUQ,data['username'])
         # 编辑文档库授权分组
         log.info('编辑文档库授权分组')
         if data['group'] == '管理员':
             driver.click(self.DOCS_GROUP1)
         if data['group'] == '财务专员':
             driver.click(self.DOCS_GROUP2)
         if data['group'] == '销售经理':
             driver.click(self.DOCS_GROUP3)
         if data['group'] == '销售人员':
             driver.click(self.DOCS_GROUP4)
         if data['group'] == '普通用户':
             driver.click(self.DOCS_GROUP5)
         #点击保存
         log.info('点击保存')
         driver.click(self.DOCS_BUTTON)
         driver.sleep(2)
     if data['libtype'] == '项目文档库':
         #编辑所属项目
         log.info('编辑所属项目')
         driver.click(self.DOCS_XMSS)
         driver.type1(self.DOCS_INPUT,'太阳当空照,花儿对我笑')
         # 编辑文档库名称
         log.info('编辑文档库名称')
         driver.click(self.DOCS_MZI)
         driver.type1(self.DOCS_MZI,data['name'])
         # 编辑文档库授权用户
         log.info('编辑文档库授权用户')
         driver.click(self.DOCS_SHOUQ)
         driver.type1(self.DOCS_SHOUQ,data['username'])
         # 编辑文档库授权分组
         log.info('编辑文档库授权分组')
         if data['group'] == '管理员':
             driver.click(self.DOCS_GROUP1)
         if data['group'] == '财务专员':
             driver.click(self.DOCS_GROUP2)
         if data['group'] == '销售经理':
             driver.click(self.DOCS_GROUP3)
         if data['group'] == '销售人员':
             driver.click(self.DOCS_GROUP4)
         if data['group'] == '普通用户':
             driver.click(self.DOCS_GROUP5)
         #点击保存
         log.info('点击保存')
         driver.click(self.DOCS_BUTTON)
         driver.sleep(2)
     # 添加维护分类
     # driver.click(self.DOCS_FENLEI)
     # driver.sleep(1)
     # 编辑类目
     # driver.type1(self.DOCS_LEI1, '金融')
     # driver.type1(self.DOCS_LEI2, '汽车')
     # driver.type1(self.DOCS_LEI3, '旅游')
     # driver.type1(self.DOCS_LEI4, '美食')
     # driver.type1(self.DOCS_LEI5, '人道')
     # driver.sleep(1)
     # driver.click(self.DOCS_BUTTON)
     # driver.sleep(2)
     log.info('跳出最外层框架')
     driver.switch_default_frame()
     driver.sleep(2)
Ejemplo n.º 6
0
 def adddoc(self, data):
     driver = self.base_driver
     log = Log('..\\logs')
     # 休眠等待
     driver.sleep(1)
     # 点击文档
     log.info('点击文档')
     driver.click(self.DOCS_WEND)
     driver.sleep(1)
     #点击首页
     log.info('点击首页')
     driver.switch_to_frame(self.DOCS_FRAME)
     driver.click(self.ADOC_SHOUYE)
     #点击我的项目库
     log.info('点击我的项目库')
     driver.click(self.ADDOC_XMUKU)
     #点击创建文档
     driver.click(self.ADDOC_CJWD)
     #编辑所属分类
     log.info('选择所属分类')
     driver.click(self.ADDOC_SHUXING)
     driver.select_by_visible_text(self.ADDOC_SHUXING,data['module'])
     #编辑文档库授权用户
     log.info('选择授权用户')
     driver.click(self.DOCS_SHOUQ)
     driver.type1(self.DOCS_SHOUQ,data['username'])
     # 编辑文档库授权分组
     log.info('选择授权分组')
     if data['group'] == '管理员':
         driver.click(self.DOCS_GROUP1)
     if data['group'] == '财务专员':
         driver.click(self.DOCS_GROUP2)
     if data['group'] == '销售经理':
         driver.click(self.DOCS_GROUP3)
     if data['group'] == '销售人员':
         driver.click(self.DOCS_GROUP4)
     if data['group'] == '普通用户':
         driver.click(self.DOCS_GROUP5)
         log.info('选择文档')
     if data['type'] == '文档':
         driver.click(self.ADDOC_WENG)
         log.info('输入文档标题')
         driver.click(self.ADDOC_TITLE)
         driver.type(self.ADDOC_TITLE, data['title'])
         log.info('点击段落')
         driver.click1(self.ADDOC_DUANL)
         driver.click(self.ADDOC_GS)
         log.info('输入文档正文')
         driver.type2(self.ADDOC_ZWEN, data['body'])
         log.info('输入关键字')
         driver.type(self.ADDOC_KEY, data['key'])
         log.info('输入文档摘要')
         driver.click(self.ADDOC_ZHAIY)
         driver.type1(self.ADDOC_ZHAIY,data['body'])
     if data['type'] == '链接':
         log.info('选择链接')
         driver.click(self.ADDOC_LIANJIE)
         log.info('输入文档标题')
         driver.click(self.ADDOC_LIEJIE)
         driver.type1(self.ADDOC_TITLE, data['title'])
         log.info('输入url')
         driver.type1(self.ADDOC_URL,'http://baidu.com')
         log.info('输入关键字')
         driver.click(self.ADDOC_KEY)
         driver.type1(self.ADDOC_KEY, data['key'])
         log.info('输入文档摘要')
         driver.click(self.ADDOC_ZHAIY)
         driver.type1(self.ADDOC_ZHAIY,data['body'])
     #上传附件
     log.info('上传附件')
     driver.type2(self.ADDOC_FUJIAN,r"C:\Users\hzpower\PycharmProjects\ranzhi39\data\adddoc.csv")
     #点击保存
     log.info('点击保存')
     driver.click(self.DOCS_BUTTON)
     driver.sleep(2)
     driver.switch_default_frame()
Ejemplo n.º 7
0
    def dialogueset(self, data):
        driver = self.base_driver
        log = Log('logs')
        # 点击客服设置
        driver.move_to(self.seting_mk)
        driver.click(self.seting_mk)
        driver.sleep(3)
        # 进入iframe
        driver.switch_to_frame(self.seting_frame)
        # 点击对话设置
        driver.click(self.seting_duihua)
        driver.sleep(3)
        # 点击重置
        driver.click(self.seting_reset)
        # 编辑人工坐席接入欢迎语
        driver.type(self.seting_welcome, data['welcomemsg'])
        # 编辑无坐席在线提示信息
        driver.type(self.seting_hint, data['noagentmsg'])
        # 编辑坐席忙时提示消息
        driver.type(self.seting_busy, data['busymsg'])
        # 编辑人工坐席分配成功提示消息
        driver.type(self.seting_success, data['successmsg'])
        # 编辑坐席服务结束提示消息
        driver.type(self.seting_finess, data['finessmsg'])
        # 编辑坐席分配策略
        driver.click(self.seting_policy)
        driver.cycle(self.seting_policy1, data['policy'])
        driver.sleep(1)
        # 编辑坐席分配最大访客数量
        driver.click(self.seting_maxnum)
        driver.cycle(self.seting_maxnum1, data['maxnum'])
        driver.sleep(1)
        # 编辑坐席就绪时分配最大访客数量
        driver.click(self.seting_ready)
        driver.cycle(self.seting_ready1, data['readynum'])
        driver.sleep(1)
        q = driver.is_attribute_in(self.seting_historyqy, 'layui-form-checked')
        print('返回值:历史服务坐席优先分配', q)
        if True:
            pass
        if False:
            # 启用历史服务坐席优先分配
            driver.click(self.seting_historyqy)
        # 判断客户超时提醒是否启用
        s = driver.is_element_exist(self.seting_timeout)
        print('返回值:客户超时提醒', s)
        if False:
            # 启用客户超时提醒,编辑超时时长,超时提示信息
            driver.click(self.seting_timeoutqy)
            driver.type(self.seting_timeout, data['timeout'])
            driver.type(self.seting_timeoutmsg, data['timeoutmsg'])
        if True:
            # 禁用客户超时提醒
            driver.click(self.seting_timeoutqy)
        # 判断客户超时提醒后再次超时是否启用
        g = driver.is_element_exist(self.seting_retimeout)
        print('返回值:客户超时提醒后再次超时', g)
        if False:
            # 启用客户超时提醒后再次超时,编辑提醒后再次超时时长,提醒后再次超时后断开的提示消息
            driver.click(self.seting_timeoutqy1)
            driver.type(self.seting_retimeout, data['retimeout'])
            driver.type(self.seting_retimeoutmsg, data['retimeoutmsg'])
        if True:
            # 禁用客户超时提醒后再次超时
            driver.click(self.seting_timeoutqy1)
        # 判断坐席回复超时是否启用
        u = driver.is_element_exist(self.seting_agenttimeout)
        print('返回值:坐席回复超时', u)
        if False:
            # 启用坐席回复超时,编辑超时时长,超时提示信息
            driver.click(self.seting_agenttimeoutqy)
            driver.type(self.seting_agenttimeout, data['agenttimeout'])
            driver.type(self.seting_agenttimeoutmsg, data['agenttimeoutmsg'])
        if True:
            # 禁用坐席回复超时
            driver.click(self.seting_agenttimeoutqy)
        # 判断工作时间段是否启用
        o = driver.is_element_exist(self.seting_hourcheckqy)
        print('返回值:工作时间段', o)
        if False:
            # 启用工作时间段,编辑工作时间段提示信息
            driver.click(self.seting_hourcheckqy)
            # 设置工作开始时间
            driver.click(self.seting_hourclick1)
            driver.cycle(self.seting_hourcheck1, data['hour'])
            driver.click(self.seting_hourclick2)
            driver.cycle(self.seting_hourcheck2, data['minute'])
            driver.click(self.seting_hourclick3)
            # 设置工作结束时间
            driver.cycle(self.seting_hourcheck3, data['rehour'])
            driver.click(self.seting_hourclick4)
            driver.cycle(self.seting_hourcheck4, data['reminute'])
            driver.type2(self.seting_hourchecktip, data['hourchecktip'])
        if True:
            # 禁用工作时间段设置
            driver.click(self.seting_hourcheckqy)
        w = driver.is_attribute_in(self.seting_degree, 'layui-form-checked')
        print('返回值:满意度调查', w)
        if True:
            pass
        if False:
            # 启用满意度调查
            driver.click(self.seting_degree)
        # 点击保存
        driver.click(self.seting_button)
        driver.sleep(3)

        # 点击黑名单
        driver.click(self.black_click)
        # 判断一个元素是否存在
        k = driver.is_element_exist(self.black_del)
        print('返回值:删除某一条黑名单', k)
        if False:
            # 删除某一条黑名单
            driver.click(self.black_del)
            # 点击确定
            driver.click(self.black_sure)
        else:
            pass
        driver.switch_to_parent_frame()
Ejemplo n.º 8
0
        self.graph_show.setRange(yRange=[0.3, self.channel_num+0.7], xRange=(-0.01*pointspersecond, (show_time+0.1)*pointspersecond), padding=0)
        self.graph_show.clear()
        axis_x = self.graph_show.getAxis('bottom')
        axis_y = self.graph_show.getAxis('left')
        xticks = range(pointspersecond, show_time*pointspersecond + 1, pointspersecond)
        yticks = range(1, self.channel_num+1)
        axis_x.setTicks([[(i, str(i//pointspersecond)) for i in xticks]])
        axis_y.setTicks([[(i, str(i)) for i in yticks]])
        self.graph_show.invertY()
        for i in range(self.channel_num+1):
            self.graph_show.addLine(y=i+0.5, pen='k')
        for i in range(pointspersecond, show_time*pointspersecond, pointspersecond):
            self.graph_show.addLine(x=i, pen='k')
        self.list_curve = []
        for i in range(self.channel_num):
            self.list_curve.append(self.graph_show.plot())
            self.list_curve[i].setClipToView(True)

if __name__ == '__main__':
    import sys
    from PyQt5.QtWidgets import QApplication
    app = QApplication(sys.argv)
    config_ini_path = os.path.join(os.path.split(os.path.realpath(__file__))[0], os.path.pardir, 'config', 'config.ini')
    config_temp_path = os.path.join(os.path.split(os.path.realpath(__file__))[0], os.path.pardir, '.temp', 'config.ini')
    log = Log(os.path.join(os.path.split(os.path.realpath(__file__))[0], os.path.pardir, 'log', 'log.out'))
    conf = ConfigProcess(config_ini_path, config_temp_path, log)
    win = WindowGraphShowLogic(conf, log)
    win.show()
    sys.exit(app.exec_())

Ejemplo n.º 9
0
 def __init__(self):
     Getlog = Log('getCase')
     self.getlog = Getlog.log()
     self.basedb = BaseDB()
     self.getconfig = CONFIG()
Ejemplo n.º 10
0
 def adduser(self,data):
     driver =self.base_driver
     #休眠等待
     driver.sleep(1)
     #点击后台管理
     log = Log('..\\logs')
     log.info('点击后台管理')
     driver.click(self.ADDUSER_HOUITAI)
     # 点击组织
     log.info('点击组织')
     driver.sleep(2)
     driver.switch_to_frame(self.ADDUSER_FRAME)
     driver.click(self.ADDUSER_ZUZHI)
     #点击添加成员
     log.info('点击添加成员')
     driver.click(self.ADDUSER_TIANJIA)
     #输入用户名,真实姓名
     log.info('输入用户名,真实姓名')
     driver.type(self.ADDUSER_NAME,data['name'])
     driver.type(self.ADDUSER_RLNM,data['realname'])
     #选择性别
     log.info('选择性别')
     if data['sex'] =='男':
         driver.click(self.GENDERM_BUTTON)
     if data['sex'] =='女':
         driver.click(self.GENDERF_BUTTON)
     else:
         pass
     #选择部门,角色
     log.info('选择部门,角色')
     driver.select_by_visible_text(self.ADDUSER_DEPT,data['dept'])
     driver.select_by_value(self.ADDUSER_ROLE,data['role'])
     #输入密码,重复密码,邮箱
     log.info('输入密码,重复密码,邮箱')
     driver.type(self.ADDUSER_PWD1,data['password1'])
     driver.type(self.ADDUSER_PWD2,data['password2'])
     driver.type(self.ADDUSER_EMAIL,data['email'])
     #点击保存
     log.info('点击保存')
     driver.click(self.BAOCUN_BUTTON)
     driver.sleep(1)
     # 获取url
     log.info('获取url')
     self.ADDUSER_URL = driver.get_url()
     try:
         driver.click(self.ADDUSER_URL)
     except Exception as msg:
         driver.get_screenshot('screenshot')
     #获取错误提示文本
     log.info('获取用户名错误提示文本')
     if data['casetype'] =='用户名错误' \
             or data['casetype'] =='用户名错误1' \
             or data['casetype'] =='用户名错误2' \
             or data['casetype'] =='用户名错误3':
         self.nametext =driver.get_text(self.ADDUSER_NAMETEXT)
     log.info('获取姓名错误提示文本')
     if data['casetype'] =='姓名错误':
         self.realnametext =driver.get_text(self.ADDUSER_RLNMTEXT)
     log.info('获取角色错误提示文本')
     if data['casetype'] =='角色错误':
         self.roletext =driver.get_text(self.ADDUSER_ROLETEXT)
     log.info('获取密码错误提示文本')
     if data['casetype'] =='密码错误':
         self.pwd1text =driver.get_text(self.ADDUSER_PWD1TEXT)
     log.info('获取邮箱错误提示文本')
     if data['casetype'] =='邮箱错误' \
             or data['casetype'] =='邮箱错误1'\
             or data['casetype'] =='邮箱错误2' \
             or data['casetype'] == '邮箱错误3':
         self.emailtext =driver.get_text(self.ADDUSER_EMAILTEXT)
     driver.switch_default_frame()
Ejemplo n.º 11
0
def index():
    Log.debug('Mensagem de DEBUG', app)
    Log.info('Mensagem de INFO', app)
    controller = IndexController(app)
    return controller.index()
Ejemplo n.º 12
0
'''
通过baseCode获取案例数据,结果为列表,通过baseHttp获取response
将response.content转为字典,读取code与testcase中的HttpCode比较
'''
import pytest
#from . import rootdir
#import operationConfig
from base.baseCode import BaseCode
from base.baseHttp import BaseHttp
from base.log import Log
import json
basecode = BaseCode()
basehttp = BaseHttp()
case_data = basecode.get_rowcase_data('TestCase')  #如果读取单行,后加行数
GetLog = Log('test_Run')
getlog = GetLog.log()
# def func(x):
#     return x+1
# def test_func():
#     assert func(4) == 5cd
# @pytest.mark.parametrize('a,b,excepted',[(1,2,3),(2,3,6)])
# def test_1(a,b,excepted):
#     assert a+b == excepted


@pytest.mark.parametrize('case_data', case_data)
def test_allcase(case_data):
    getlog.info('-----------{0}案例执行开始----------------------------'.format(
        case_data['测试用例']))
    if case_data['请求方法'] == 'post':
        res = basehttp.post(case_data['接口路径'], case_data['请求体'])
Ejemplo n.º 13
0
 def log(self, msg):
     log = Log('logs')
     log.info(msg)
Ejemplo n.º 14
0
import os, sqlite3
from operationConfig import CONFIG
import operationConfig as opconfig
from base.log import Log

getconfig = CONFIG()

Getlog = Log('basedb')
getlog = Getlog.log()
db_path = getconfig.get_config_value('DATABASE', 'db_path')
sqlpath = os.path.join(opconfig.PROJECT_DIR, db_path)
getlog.info('sqllite3的地址为%s' % (sqlpath))


# db=sqlite3.connect(sqlpath)
# cursor=db.cursor()
# data=cursor.execute('select * from Webserver_testcase')
# data1=data.fetchall()
# print(data,data1)
class BaseDB(object):
    def __init__(self):
        try:
            self.db = sqlite3.connect(sqlpath)
            self.cursor = self.db.cursor()
        except ConnectionError as e:
            getlog.error('连接数据报错了,报错信息为:{0}'.format(e))

    def excutesql(self, sql):
        reslut = self.cursor.execute(sql)
        self.db.commit()
        getlog.info('数据库执行结果为{0}'.format(reslut))
Ejemplo n.º 15
0
 def project(self, data):
     driver = self.base_driver
     #休眠等待
     # driver.sleep(1)
     #点击项目
     log = Log('logs')
     log.info('点击项目')
     driver.click(self.PROJ_XMU)
     driver.sleep(1)
     #点击添加区块
     log.info('点击添加区块')
     driver.switch_to_frame(self.PROJ_FRAME)
     driver.click(self.PROJ_QUKUAI)
     driver.sleep(1)
     driver.select_by_visible_text(self.PROJ_QUK, data['blocks'])
     driver.sleep(1)
     #编辑项目类型
     if data['blocks'] == '任务列表':
         # 输入任务区块名称
         log.info('输入任务区块名称')
         driver.click(self.PROJ_TITLE)
         driver.type1(self.PROJ_TITLE, data['title'])
         #编辑外观
         log.info('编辑外观')
         driver.select_by_visible_text(self.PROJ_KUANGD, data['grid'])
         driver.get_attribute(self.PROJ_YANSE, data['data-id'])
         #编辑类型
         log.info('编辑类型')
         driver.click(self.PROJ_LEIXING)
         driver.type1(self.PROJ_LEIX, '由我创建')
         #编辑数量
         log.info('编辑数量')
         driver.click(self.PROJ_NUM)
         driver.type(self.PROJ_NUM, data['num'])
         #编辑排序
         log.info('编辑排序')
         driver.click(self.PROJ_ORDERBY)
         driver.type1(self.PROJ_ORDERBY, '优先级递增')
         #编辑任务状态
         log.info('编辑任务状态')
         driver.click(self.PROJ_DSTATUS)
         driver.type1(self.PROJ_DSTATUS, '已关闭')
         #点击保存
         log.info('点击保存')
         driver.click(self.PROJ_BUTTON)
     if data['blocks'] == '项目列表':
         driver.type1(self.PROJ_TITLE, data['title'])
         # 编辑外观
         log.info('编辑外观')
         driver.select_by_visible_text(self.PROJ_KUANGD, data['grid'])
         driver.get_attribute(self.PROJ_YANSE, data['data-id'])
         # 编辑状态
         log.info('编辑状态')
         driver.click(self.PROJ_STATUS)
         driver.type1(self.PROJ_JINXZ, '我参与的')
         # 编辑数量
         log.info('编辑数量')
         driver.click(self.PROJ_NUM)
         driver.type(self.PROJ_NUM, data['num'])
         # 编辑排序
         log.info('编辑排序')
         driver.click(self.PROJ_ORDERBY)
         driver.type1(self.PROJ_ORDERBY, '优先级递增')
         # 点击保存
         log.info('点击保存')
         driver.click(self.PROJ_BUTTON)
     log.info('跳出最外层框架')
     driver.switch_default_frame()
Ejemplo n.º 16
0
#

from flask import Flask
from flask import request

import base
from base.log import Log

from controllers.index_controller import IndexController
from controllers.help_controller import HelpController

app = Flask(__name__)

flag_debug = base.config['flag_debug']

Log.debug('Flag Debug:' + flag_debug, app)


@app.route('/', methods=['GET'])
def index():
    Log.debug('Mensagem de DEBUG', app)
    Log.info('Mensagem de INFO', app)
    controller = IndexController(app)
    return controller.index()


@app.route('/hello', methods=['GET'])
def hello_world():
    return 'Hello, World!'

Ejemplo n.º 17
0
import runtest_all
from email.utils import formataddr
from decimal import Decimal
import paramiko
import os, sys
import time
from config import globalparam
import smtplib
from email.mime.text import MIMEText  #正文
from email.header import Header  #标题
from email.mime.image import MIMEImage  #图片
from email.mime.multipart import MIMEMultipart  #MIMEMulipart模块构造带附件
import datetime
from config.globalparam import get_send_emails, get_send_pwd, get_receiver_emails, get_acc_emails

logger = Log()

report_path = globalparam.get_report_path()
sender = get_send_emails()
login_pwd = get_send_pwd()
receivers = get_receiver_emails()
acc = get_acc_emails()
report_path = runtest_all.new_file(report_path)
filename = report_path.split('/')[-1]

img_path = globalparam.get_img_path()
img_path = runtest_all.new_file(img_path)
imgname = img_path.split('/')[-1]

# receivers=['*****@*****.**','*****@*****.**']
# acc=['*****@*****.**','*****@*****.**']
Ejemplo n.º 18
0
# -*- encoding: utf-8 -*-
import os
import time
import operationConfig
from base.log import Log

config = operationConfig.CONFIG()
report_dir = os.path.join(operationConfig.RROJECT_DIR, 'report\{0}'.format(
    time.strftime('%Y%m%d')))  #报告地址report下的当前日期下
set_value = config.set_config_value(
    'REPORT', 'path',
    '{0}'.format(report_dir))  #将报告地址写入ini文件中,log记录日志的地址也是该目录下
if not os.path.exists(report_dir):
    os.mkdir(report_dir)
GetLog = Log('Run')
getlog = GetLog.log()

result = os.system('pytest RunCode --html={0}/report{1}.html'.format(
    report_dir, time.strftime('%H%M%S')))

getlog.info('报告执行结果查看执行报告')
Ejemplo n.º 19
0
 def login(self, data):
     '''测试登陆'''
     # 通过base_driver获取RanzhiDriver里面的driver
     driver =self.base_driver
     #休眠等待
     driver.sleep(1)
     #输入用户名密码
     log = Log('logs')
     log.info('输入用户名')
     driver.type1(self.LOGIN_USER,data['name'])
     log.info('输入密码')
     driver.type1(self.LOGIN_PWD,data['password'])
     #点击登录
     log.info('登录然之协同')
     driver.click(self.LOGIN_BUTTON)
     #休眠等待
     driver.sleep(1)
     if data['casetype'] =='登陆成功':
         log.info('登录成功后获取页面标题')
         self.LOGIN_TITLE = driver.get_title()
         print(self.LOGIN_TITLE)
         log.info('点击签退')
         driver.click(self.LOGINOUT_BUTTON)
         driver.sleep(1)
     if data['casetype'] =='登陆失败':
         log.info('登录失败后获取错误提示信息')
         self.LOGIN_TEXT = driver.get_text()
         print(self.LOGIN_TEXT)
         log.info('点击确定按钮')
         driver.click(self.LOGIN_BUTTON_DISMISS)
         driver.sleep(1)