zoukankan      html  css  js  c++  java
  • AppUi自动化框架main.py代码

    from lib.path import APP_CASE, APP_REPORT, EMAIL_INFO
    import unittest
    from lib.appController import Controller
    from BeautifulReport import BeautifulReport
    from lib.sendmail_new import SendMail
    from lib.tools import get_new_report, remove_report

    user = EMAIL_INFO.get('user') # 从配置文件中获取邮件用户名
    password = EMAIL_INFO.get('password') # 从配置文件中获取邮箱授权码
    host = EMAIL_INFO.get('host') # 从配置文件中获取邮件服务器
    to = EMAIL_INFO.get('to') # 从配置文件中获取邮件接收者
    cc = EMAIL_INFO.get('cc') # 从配置文件中获取抄送邮箱
    subject = EMAIL_INFO.get('subject') # 从配置文件中获取邮件标题
    contents = EMAIL_INFO.get('contents') # 从配置文件中获取邮件内容
    attachments = EMAIL_INFO.get('attachments') # 从配置文件中获取邮件


    class Main(object):
    def __init__(self):
    self.controller = Controller()
    self.deviceName = self.controller.deviceName

    def run(self):
    self.controller.start_server()
    if self.controller.test_server():
    print('111')
    self.controller.start_driver()
    print('222')
    suit = unittest.TestSuite()
    cases = unittest.defaultTestLoader.discover(APP_CASE)
    for case in cases:
    suit.addTest(case)
    run = BeautifulReport(suit) # 实例化BeautifulReport模块
    run.report(filename="{}.html".format(self.deviceName), description='用例执行情况', log_path=APP_REPORT)


    if __name__ == '__main__':
    m = Main()
    m.run()
    filename = get_new_report()
    send = SendMail(user, password, host, to, cc, subject, contents, filename)
    send.send_mail()
    remove_report()
  • 相关阅读:
    【转载】mysqldump的single-transaction和master-data
    MySQL 从库日志比主库多
    Error_code: 2003
    通过替换frm文件方式修改表结构
    ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
    批量kill mysql processlist进程
    libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.9-1.el6.x86_64
    MySQL 5.7.9的多源复制
    Java-Clone 对象拷贝
    Windows 运行库
  • 原文地址:https://www.cnblogs.com/laosun0204/p/9748672.html
Copyright © 2011-2022 走看看