Description: This project utilizes a Page Object Pattern/Model emphasizing the strength's of Pytest's Configuration management to make the Framework extensible and maintainable. This project can serve as a great baseline template for the creation of other Web UI Frameworks.
Technologies: Python, Selenium, Pytest and Pipenv
Source: Course by Automation Panda from TestProject.io: https://blog.testproject.io/2019/07/16/python-test-automation-project-using-pytest/
- 1st, clone this repo to your local machine at any desired location. Via the Terminal, navigate to the desired directory location where you would like to save this project, then input the following command:
$ git clone https://github.com/cikent/Python-Web-UI-Test-Framework-Template
- Change the Folder name to whatever desired (i.e. "Python-Web-UI-Test-Framework-Template" to "My new Python Test Framework")
- Navigate to the Root of the Folder via the Terminal
- Via the Terminal, install Pipenv, type:
pip install pipenv
- Install Pytest for the project, type:
pipenv install pytest --dev
This should add two new files to the directory:
- Pipfile
- Pipfile.lock
- Install Selenium for the project, type:
pipenv install selenium --dev
- If you haven't already, install the latest version of Chrome here: https://www.google.com/chrome/
- Download the matching version of ChromeDriver respective to the version of Chrome installed: https://sites.google.com/a/chromium.org/chromedriver/
- Save Chromedriver locally in whatever directory is desired
- Add Chromedriver to your SYSTEM PATH respective to the Operating System utilized
- Reboot the Computer
- Verify Chromedriver is recognized by the system. Via the Terminal, type:
chromedriver
You should see something similar to:
Starting ChromeDriver <ChromeDriver Version> (47787ec04b6e38e22703e856e101e840b65afe72) on port 9515
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Quit ChromeDriver running locally via the Terminal by pressing:
Control + C
- If you haven't already, install the latest version of Firefox here: https://www.mozilla.org/en-US/firefox/new/
- Download the matching version of GeckoDriver respective to the version of Firefox installed: https://github.com/mozilla/geckodriver/releases
- Save GeckoDriver locally in whatever directory is desired
- Add GeckoDriver to your SYSTEM PATH respective to the Operating System utilized
- Reboot the Computer
- Navigate to the Root of the Folder via the Terminal
- Execute the following command:
$ pipenv run python -m pytest
- The Framework should run. If not, investigate and resolve issues as necessary.
- To run this project, all you have to do is navigate to the respective Root directory where this project was saved locally via the Terminal, then execute the following command:
$ pipenv run python -m pytest
I plan to implement the following functionality to this Template Project in the near future:
- Extend the Framework to have basic Page Object Model (POM) Test's for Formy: https://formy-project.herokuapp.com/
- Update Test Reporting to have Pytest HTML Output : https://blog.testproject.io/2019/07/16/create-pytest-html-test-reports/
- Parallel Test Execution with Pytest: https://blog.testproject.io/2019/07/16/parallel-test-execution-with-pytest/.
- Scale Your Test Automation using Selenium Grid and Remote WebDrivers: https://blog.testproject.io/2019/07/16/using-selenium-grid-and-remote-webdrivers/
- Automated Mobile App Testing using Appium and Python: https://blog.testproject.io/2019/07/16/automated-mobile-app-using-appium-and-python/
- Create Behavior-Driven Python Tests using Pytest-BDD: https://blog.testproject.io/2019/07/16/behavior-driven-python-tests-using-pytest-bdd/
- Email: [email protected]
- LinkedIn: https://www.linkedin.com/in/christopher-kent-9a836631/