Introduction to PyTest

In the past, when I learned to use unitTest, I would encounter some doubts in the process of using it. In the process of querying data to solve the problem, I learned about the third party unit test framework under Python: PyTest. So what are the advantages of PyTest? To summarize briefly:

  • Pytest is a very mature, full-featured Python testing framework
  • You can perform various scenarios that UnitTest can do, such as: unit testing, interface testing, Web testing, and so on
  • Pytest is more of a plug-in platform, which makes it more powerful than UnitTest. Over the years, a number of third-party plug-ins have extended and enhanced its functionality
  • You can also customize your own plug-ins to suit your own needs. All in all, PyTest is much simpler and more flexible to use.

Install PyTest

Haha, cliche. Although a search can get things, but since I saw this article, I will send Buddha to the west, here is a very simple installation way PIP installation.

Open Windows CMD and enter python -m PIP install -u pytest



The installation is successful, the machine has been installed in the screenshot.

After the installation is complete, check whether the installation is successful by typing pytest — Version

As shown in figure