zoukankan      html  css  js  c++  java
  • python nose自动化框架学习笔记(一)

    使用插件:

    使用pip安装所需要的插件,然后通过nosetests命令行配置插件。执行如下命令验证所安装的插件,

    nosetests –plugins

    在命令行中添加

    -v或者-vv选项可以显示每一个插件的更多信息。 如果通过nose.main()或者nose.run()执行测试,可以将要使用的插件关键字参数的列表传递进去。

    常用插件:
    跳过用例 from nose.plugins.skip import SkipTestraise SkipTest
     attrib标签
    from nose.plugins.attrib import attr 
    @attr(speed='slow') 
    def test_big_download(): 
    pass 
    命令行$ nosetests -a speed=slow
     超时机制Timeout  
    from nose.tools import timed
    import time
    @time(1)
    def test_lean_5()
        time.sleep(2)
        pass
     report  pip install nose-htmloutput--with-html --html-file=
     log  --nologcapture不使用log--loging-format=FORMAT 使用自定义的格式显示日志--logging-datefmt=FORMAT和上面类似,多了日期格式--logging-filter=FILTER日志过滤,一般很少用,可以不关注--logging-clear-handlers也可以不关注--logging-level=DEFAULT log的等级定义
    只列出用例collect-only nosetests --collect-onlynosetests -v --with-id
    xml报告 --with-xunit

     

     

     

  • 相关阅读:
    teamviewer被识别为商用的解决办法
    PLY调试笔记——待解决的问题
    python中的反射
    类的继承顺序
    面向对象---继承
    类成名和命名空间
    面向对象编程
    模块的初始
    装饰器
    列表推导式,生成器
  • 原文地址:https://www.cnblogs.com/helloTerry1987/p/10746913.html
Copyright © 2011-2022 走看看