zoukankan      html  css  js  c++  java
  • 套件的使用追加

    方法一: 执行类下面的 测试case

    if __name__ == '__main__':
    suiteTest = unittest.TestSuite()
    suiteTest.addTest(TestAuto("testCase_001"))
    suiteTest.addTest(TestAuto("testCase_002"))
    unittest.TextTestRunner(verbosity=2).run(suiteTest)

    # 按照一定时间格式获取当前时间(防止测试报告覆盖)
    now = time.strftime(u'%Y-%m-%d-%H-%M-%S')
    # 确定生成报告的路径
    report_file = "F:\python3\report\" + now + "_test_report.html"
    with open(report_file, 'wb') as report:
    runner = HTMLTestReportCN.HTMLTestRunner(stream=report, title=u'测试报告',
    description=u'如下为用例执行结果,请查阅!',
    )
    runner.run(suiteTest)
    report.close()

    方法二: 按测试类执行

    if __name__ == '__main__':
    suiteTest = unittest.TestSuite(unittest.makeSuite(TestAuto))
    '''
    这里的verbosity是一个选项,表示测试结果的信息复杂度,有三个值
    0 (静默模式): 你只能获得总的测试用例数和总的结果 比如 总共100个 失败20 成功80
    1 (默认模式): 非常类似静默模式 只是在每个成功的用例前面有个“.” 每个失败的用例前面有个 “F”
    2 (详细模式):测试结果会显示每个测试用例的所有相关的信息
    并且 你在命令行里加入不同的参数可以起到一样的效果
    加入 –quiet 参数 等效于 verbosity=0
    '''
    unittest.TextTestRunner(verbosity=2).run(suiteTest)

    # 按照一定时间格式获取当前时间(防止测试报告覆盖)
    now = time.strftime(u'%Y-%m-%d-%H-%M-%S')
    # 确定生成报告的路径
    report_file = "F:\python3\report\" + now + "_test_report.html"
    with open(report_file, 'wb') as report:
    runner = HTMLTestReportCN.HTMLTestRunner(stream=report, title=u'测试报告',
    description=u'如下为用例执行结果,请查阅!',
    )

    runner.run(suiteTest)
    report.close()

    方法三: 执行一个文件

    f __name__ == '__main__':
    suiteTest = unittest.Testloader().loadTestsFromModule('seleniumtest.py')
    '''
    这里的verbosity是一个选项,表示测试结果的信息复杂度,有三个值
    0 (静默模式): 你只能获得总的测试用例数和总的结果 比如 总共100个 失败20 成功80
    1 (默认模式): 非常类似静默模式 只是在每个成功的用例前面有个“.” 每个失败的用例前面有个 “F”
    2 (详细模式):测试结果会显示每个测试用例的所有相关的信息
    并且 你在命令行里加入不同的参数可以起到一样的效果
    加入 –quiet 参数 等效于 verbosity=0
    '''
    unittest.TextTestRunner(verbosity=2).run(suiteTest)

    # 按照一定时间格式获取当前时间(防止测试报告覆盖)
    now = time.strftime(u'%Y-%m-%d-%H-%M-%S')
    # 确定生成报告的路径
    report_file = "F:\python3\report\" + now + "_test_report.html"
    with open(report_file, 'wb') as report:
    runner = HTMLTestReportCN.HTMLTestRunner(stream=report, title=u'测试报告',
    description=u'如下为用例执行结果,请查阅!',
    )

    runner.run(suiteTest)
    report.close()

    来源: https://mp.weixin.qq.com/s/MiwG6jXCCnTl5Y2FhJTPVg

  • 相关阅读:
    RedHat 更新CentOS Yum源(转)
    ubuntu 印象笔记
    (转)FFMPEG filter使用实例(实现视频缩放,裁剪,水印等)
    (转)学习ffmpeg官方示例transcoding.c遇到的问题和解决方法
    源码调用ffmpeg库时,需要注意接口为C接口
    codeforces 722D Generating Sets 【优先队列】
    poj2970 The lazy programmer 【优先队列】
    codeblocks17.12 不能启动调试器
    Unity动画知识之二:Animator动画状态机
    关于unity里pbr技术和材质 unity5默认shader和传统的对比
  • 原文地址:https://www.cnblogs.com/kaibindirver/p/12887133.html
Copyright © 2011-2022 走看看