zoukankan      html  css  js  c++  java
  • python

    testSuitr.py:

    # -*- coding:utf-8 -*-

    '''
    @project: Voctest
    @author: Jimmy
    @file: testSuite.py
    @ide: PyCharm Community Edition
    @time: 2018-11-14 15:40
    @blog: https://www.cnblogs.com/gotesting/

    '''

    import unittest
    from TestCase import test_login
    # from TestCase.test_login import TestLogin

    suite = unittest.TestSuite()
    loader = unittest.TestLoader()

    # 通过加载测试类所在模块加载测试用例
    suite.addTest(loader.loadTestsFromModule(test_login))


    # 通过加载测试类来加载测试用例
    # suite.addTest((loader.loadTestsFromTestCase(TestLogin)))





    testRun.py:

    # -*- coding:utf-8 -*-

    '''
    @project: Voctest
    @author: Jimmy
    @file: testRun.py
    @ide: PyCharm Community Edition
    @time: 2018-11-14 15:49
    @blog: https://www.cnblogs.com/gotesting/

    '''

    import unittest
    import HTMLTestRunner
    import time

    from Config.globalConfig import *
    from TestSuite import testSuite
    from Common.log import Log
    from Common.sendMail import SendMail

    def run_test():


    runner = unittest.TextTestRunner()
    curTime = time.strftime('%Y-%m-%d_%H_%M_%S')
    report_name = report_path + '\' + 'TestResult-' + curTime + '.html'
    with open(report_name,'wb') as f:
    runner = HTMLTestRunner.HTMLTestRunner(
    stream = f,
    title = '测试报告'
    )
    runner.run(testSuite.suite)

    time.sleep(3)
    mail = SendMail()
    mail.send()

    if __name__ == '__main__':
    logger = Log()
    logger.log_info('*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- Auto Test Comming -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*')
    run_test()
    logger.log_info('*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- Auto Test Done -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*')
  • 相关阅读:
    Pyinstaller(python打包为exe文件)
    matplotlib 填充颜色
    Visual Studio 2015 Enterprise
    latex中pdflatex与xelatex的区别
    latex插图续
    dva+umi+antd项目从搭建到使用(没有剖验证,不知道在说i什么)
    umi+dva+antd新建项目(亲测可用)
    HTTP缓存机制
    企业网站常见需求整理
    立足于运维与监控的前端框架 NoahV
  • 原文地址:https://www.cnblogs.com/gotesting/p/9965261.html
Copyright © 2011-2022 走看看