zoukankan      html  css  js  c++  java
  • UnitTest.TestSuite 5种用例套件方法+运行器

    suite = unittest.TestSuite()

    1. suite.addTest(类名("用例名"))
      runner = unittest.HtmlTestRunner()
      runner.run(suite)

    2. cases = [类名('用例名1'),类名('用例名2'),类名('用例名3'),类名('用例名4')]
      suite.addTests(cases)
      runner = unittest.HtmlTestRunner()
      runner.run(suite)

    3. Test_dir = './'
      discover = unittest.defaultTestLoader.discover(start_dir = test_dir, pattern =’unit_for*.py’) # 执行 前缀为unit_for的py文件
      runner = unittest.HtmlTestRunner()
      runner.run(discover)

    4. Suite.addTests(unitTest.TestLoader().loadTestsFromTestCase(类名))
      runner = unittest.HtmlTestRunner()
      runner.run(suite)

    5. Suite.addTests(unittest.TestLoader().loadTestsFromName(‘文件名.类名)) # 文件名不用加 .py
      runner = unittest.HtmlTestRunner()
      runner.run(suite)

  • 相关阅读:
    元类、orm
    MySQL进阶
    python操作mysql
    tf矩阵基础
    tensorflow安装时遇到的问题
    Loading
    弹球落地
    3dMenu
    响应式布局:flex
    渐变linear-gradient
  • 原文地址:https://www.cnblogs.com/zhen9436/p/14055447.html
Copyright © 2011-2022 走看看