Comparison of Python unit test frameworks Nose and pytest

Source: Internet
Author: User

The Python automated testing RobotFramework does a good job, but it is not convenient in some places. Although one of python is studious, the addition of east and east in the Robot Framework increases the learning difficulty and is not conducive to the development of automated testing. 2. RobotFramework has castrated many python functions. For example, it is difficult to nest for. At the same time, you have to look at the unit test framework of python. Unittest and doctest in the standard Python library have simple unit test functions. However, we need to test the use case tag function. An example of this tag: Our test cases can be labeled as high, some labeled as middle, some labeled as low, and you can choose to execute as high or all cases. None of these functions are supported by unittest and doctest. So we switched to the external module. From the perspective of pypi, the external unit test modules mainly include pytest and nose. Nose downloads are several times higher than pytest. On the surface, you should definitely choose Nose. In practice, it is found that Nose is not suitable for our project. See the following comparison results. In terms of documentation: The py. test documents are made into exquisite pdf documents with detailed examples. Nose documents only contain web files, and almost no instances can be found. The test shows that we have no strict requirements on this part. Both Nose and py. test can meet the requirements. Test Report: pytest is much better than Nose. The following is an example of an empty test: [root @ SZX-SRV-AUTOMATIONlib] # nosetests revoke Ran0 tests in 0.000 s OK [root @ SZX-SRV-AUTOMATIONlib] # py. test ============================================== ===================================== test session starts ================== ========================================================== ============== platformlinux2 -- Python 2.6.6 -- pytest-2.3.4collected0 items ======================= ========================================================== ===== in 0.00 seconds ==================================== ==================================== [root @ SZX-SRV- AUTOMATIONlib] #

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.