Table of Contents
This repo contains boilerplate code to get up-and-running with Automated UI Testing using Selenium & PyTest. It is intended to be used as a foundation for writing / adding your own tests.
- Selenium - a toolset for web browser automation that uses the best techniques available to remotely control browser instances and emulate a user’s interaction with the browser
- PyTest - a framework that makes building simple and scalable tests easy
Follow the steps below to get a local development instance up & running.
-
Python3
-
pipenv
-
The drivers for each browser (Chrome & Firefox) need to be downloaded, converted to executables, and places in the
usr/local/bindirectorychmod +x Downloads/geckodriver sudo mv Downloads/geckodriver ../../usr/local/bin/
git clone
cd project_dir
pipenv shell
pipenv installNavigate to Automated Practice's create an account page and manually create a new test account. Then add the email address, password, and user name to a .env in project root.
[email protected]
PASSWORD=yourpassword
USERNAME=Your Name
Set the desired test configurations (brower and url) via the config.json file. Supported browsers are: "Headless Chrome", "Chrome", and "Firefox".
- Run All Tests
pipenv run python -m pytest
- Run Single Test Suite/File
pipenv run python -m pytest tests/test_home.py
- Run Single Test Case
pipenv run python -m pytest tests/test_home.py::test_LogoDisplayed
- Run Tests in Parallel
pipenv run python -m pytest -n 2
Tim Corley | @tcor215 | [email protected]