python 几种常见的测试框架
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 几种常见的测试框架相关的知识,希望对你有一定的参考价值。
1. unittest
参考文档: https://docs.python.org/3/library/unittest.html
The unittest unit testing framework was originally inspired by JUnit and has a similar flavor as major unit testing frameworks in other languages. It supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework.
跟 JUnit类似。
2. unittest2
参考文档: https://pypi.python.org/pypi/unittest2
unittest2 is a backport of the new features added to the unittest testing framework in Python 2.7 and onwards.
unittest2 是一个针对 unittest测试框架新特性的补丁。
3. pytest
参考文档:http://pytest.org/latest/
pytest is a mature full-featured Python testing tool that helps you write better programs.
pytest是一个成熟全面的python测试工具,可以帮助你写更好的程序。
4. nose
参考文档: https://nose.readthedocs.org/en/latest/
基于Python的测试驱动开发实战 也有nose的用法: http://python.jobbole.com/81305/
nose extends unittest to make testing easier.
nose扩展了unittest,从而使得测试更容易。
5. doctest
参考文档:https://docs.python.org/3/library/doctest.html
Python 各种测试框架简介(一):doctest http://my.oschina.net/lionets/blog/268542
The doctest module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown.
doctest模块会搜索那些看起来像交互式会话的 Python 代码片段,然后尝试执行并验证结果。
以上是关于python 几种常见的测试框架的主要内容,如果未能解决你的问题,请参考以下文章