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()
  • 相关阅读:
    常见二叉树问题
    leetcode上回溯法的使用
    搜索+回溯
    navicat连接登录windows10本地wsl的数据库
    皇后问题
    拓扑排序
    三路排序算法
    在 ServiceModel 客户端配置部分中,找不到引用协定“WebServiceTest.WebServiceSoap”的默认终结点元素。这可能是因为未找到应用程序的配置文件,或者是因为客户端元素
    WCF异常信息
    C# 制作ZIP压缩包
  • 原文地址:https://www.cnblogs.com/laosun0204/p/9748672.html
Copyright © 2011-2022 走看看