Add Allure Reporting
v1.17.2 - 2022.10.26
Overview
💡 Contributing to Pylenium is even easier now that you can use Gitpod - by @ElSnoMan in #290
- Add ability to pass
local_path
via CLI arg by @vincent-olivert-riera in #285 - Add allure reporting and update logging by @ElSnoMan in #291
- Add
pyc
andpys
fixtures by @ElSnoMan in #293
See the Details section below for... well, more details 😄
Fixes
- 🐛 That pesky
webdriver_manager
bug has been resolved (#278) - 👕 pylint fixes by @marksmayo in #288
Documentation
- 📝 Github Repo README updated to include the crucial
$ pylenium init
step (#283) - 📝 Viewport configuration docs updated to show how to use viewport settings (#282)
Details
The major update for version 1.17
is the native integration with Allure for test reporting and the addition of the pys
and pyc
fixtures.
Allure Reporting
Currently, Pylenium integrates natively with ReportPortal.io which is free and open source, but is relatively complex to setup and use. I wanted a simpler reporting tool that still had rich reporting; enter Allure and their pytest plugin
In three easy steps you can leverage their awesome reporting! We also added some convenient CLI commands to help with this, although using allure
directly is recommended:
-
Install allure CLI
- You can use
pylenium allure install
- or visit their docs for your machine's appropriate installation instructions (recommended)
- then you can check the installation with
pylenium allure check
- You can use
-
Run tests
- It's just pytest, but now add where you want the allure results to be saved:
pytest --alluredir=allure-report
- It's just pytest, but now add where you want the allure results to be saved:
-
Then serve the results to generate a beautiful report in your browser!
- You can use
pylenium allure serve --folder allure-report
- or
allure serve allure-report
(recommended)
- You can use
Session- and class-scoped Pylenium instances
When writing automated tests, it's recommended that each test be atomic and independent - meaning that Test B
should not be reliant on Test A
. This is a good principle to follow and enables things like running tests in parallel, but there are times when you want a single Pylenium instance for a session or for a group of tests in a Test Class.
This is what the
pys
andpyc
fixtures are for!
-
The recommended
py
fixture is an instance of Pylenium for each test function which also comes withpy_config
which is the configuration for each test functionfrom pylenium.driver import Pylenium def test_function(py: Pylenium): py.visit("https://qap.dev") ...
-
pys
andpys_config
are used if you want a single Pylenium instance for the entire Test Sessionfrom pylenium.driver import Pylenium def test_a(pys: Pylenium): py.visit("https://qap.dev") ... def test_b(pys: Pylenium): # uses same Pylenium instance as test_a ...
-
pyc
andpyc_config
are used if you want a single Pylenium instance for an entire Test Classfrom pylenium.driver import Pylenium class TestClass: def test_a(self, pyc: Pylenium): py.visit("https://qap.dev") ... def test_b(self, pyc: Pylenium): # uses same Pylenium instance as test_a ...
💡 Using
py
is highly recommended, but now you have more options for your context 💪🏽
New Contributors 🎉
As always, a big THANK YOU to everyone that uses and contributes to Pylenium! Y'all are amazing 👏🏽
- @vincent-olivert-riera made their first contribution in #285
- @marksmayo made their first contribution in #288
Full Changelog: v1.16.0...v1.17.0