Plugins for Web Development

Web-based projects have their own testing hoops to jump through. Even pytest doesn’t make testing web applications trivial. However, quite a few pytest plugins help make it easier.

pytest-selenium: Test with a Web Browser

Selenium is a project that is used to automate control of a web browser. The pytest-selenium plugin[51] is the Python binding for it. With it, you can launch a web browser and use it to open URLs, exercise web applications, and fill out forms. You can also programmatically control the browser to test a web site or web application.

pytest-django: Test Django Applications

Django is a popular Python-based web development framework. It comes with testing hooks that allow you to test different parts of a Django application without having to use browser-based testing. By default, the builtin testing support in Django is based on unittest. The pytest-django plugin[52] allows you to use pytest instead of unittest to gain all the benefits of pytest. The plugin also includes helper functions and fixtures to speed up test implementation.

pytest-flask: Test Flask Applications

Flask is another popular framework that is sometimes referred to as a microframework. The pytest-flask plugin[53] provides a handful of fixtures to assist in testing Flask applications.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.28.70