1.pytest Introduction
- pytest python testing framework is a very mature full-featured
- Simple and flexible, approachable
- Supports parameterized
Skip the test and xfail, automatic failure retry processing such as
- Supports simple unit test and test complex functions, it can also be used for selenium / appium test automation, automatic test interfaces (pytest + requests);
- pytest and with many third-party plug-ins, and can be custom extensions, such as better quality pytest-allure (perfect html test report generation), pytest-xdist (multi-cpu distribution) and so on;
- It can be well integrated and jenkins
Similar to the unit frame unitest, but more mature than UniTest
pytest document: https: //docs.pytest.org/en/latest/contents.html
Third-party libraries: https: //pypi.org/search/ q = pytest?
2.pytest installation and dependence
pip install -U pytest U means that the upgrade
Sugar insetall pytest-PIP ( Sugar beautification of the process can run our interface)
install pytest-rerunfailures PIP ( rerunfailures can re-run the test case execution error)
install pytest-xdist PIP ( xdist multi-task concurrent execution of test cases)
the install the ASSUME pytest-PIP ( the ASSUME which may be added to test the assertion, the assertion is usually a mistake is not performed, but by using this package, can be asserted even if wrong, may proceed to the next asserted)
html pytest the install-PIP ( html result report can be generated html)
....
pip list view
pytest -h help