V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
frmongo
V2EX  ›  Python

大佬们,问个测试框架的问题

  •  
  •   frmongo · Sep 12, 2019 · 2639 views
    This topic created in 2419 days ago, the information mentioned may be changed or developed.
    目前我写的一些基于 unittest 的测试脚本大概是这样的,每个 case 里都会执行一些动作,然后检查 2~4 个对象的状态(结果要么 OK,要么 NOK )。最后 assert 这些对象状态都是好的。比如执行了 30 个 case,我想统计 30 个 case 下来,对象 1,对象 2,对象 3,对象 4 分别有多少次 OK,多少次 NOK。怎么实现最方便呢。
    目前我的实现比较傻,每次都要检查测试报告里的所有 case,然后统计出 OK 的打印次数和 NOK 的打印次数。
    Supplement 1  ·  Sep 12, 2019
    检查的对象是固定的,比如每个 case 都检查 A\B\C 的某个信息
    6 replies    2019-09-12 20:03:46 +08:00
    guyeu
        1
    guyeu  
       Sep 12, 2019
    脱离语言和框架的这类问题是没有意义的。
    建议阅读:
    https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md
    guyeu
        2
    guyeu  
       Sep 12, 2019
    sorry,看到结点是 python,那么就是 python+unittest 框架了
    iyaozhen
        3
    iyaozhen  
       Sep 12, 2019
    每个 case 里面的对象会重复吗?
    感觉 30 个 case,就 30 个对象结果,统计没啥意义吧
    frmongo
        4
    frmongo  
    OP
       Sep 12, 2019
    @guyeu 多谢多谢,分享的书也是好书
    frmongo
        5
    frmongo  
    OP
       Sep 12, 2019
    @iyaozhen 也可能是几百个,我的意思是每次都是统计相同的对象,但是每次测试,它可能反馈的文本是不同的。
    luozic
        6
    luozic  
       Sep 12, 2019 via iPhone
    报告框架? allure 或者自己去改 log 框架 自己汇总一个报告?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4672 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 10:07 · PVG 18:07 · LAX 03:07 · JFK 06:07
    ♥ Do have faith in what you're doing.