2. Setup pytest

pytest is a modern and powerful Test Framework and we want to get intellisense and autocomplete

1. Install pyleniumio

Install Pylenium into your Virtual Environment if you haven't already:

Terminal $ (venv)
pip install pyleniumio

poetry and pipenv auto-generate virtual environments for you!

2. Initialize Pylenium

Terminal $ (venv)
pylenium init

Execute this command at your Project Root

This creates three files:

  • conftest.py - This has the fixtures needed for Pylenium

  • pylenium.json - This is the configuration file for Pylenium

  • pytest.ini - This is the configuration file for pytest

By default, Pylenium uses the Chrome browser. Chrome must be installed on the machine, but you don't have to worry about installing any of the drivers.

3. Select pytest as the Test Framework

To get the most out of your IDE, you need to configure it to use pytest as the Test Framework. This will give you:

  • Intellisense

  • Autocomplete

  • Run/Debug Test functionality with breakpoints

  • more depending on IDE

1. Open Command Palette (CMD + SHIFT + P or CTRL + SHIFT + P)
2. Search for "Python: Configure Tests"
3. Select pytest

Visit the pytest docs for more info on how to use it: https://docs.pytest.org/

Last updated