Skip to content

Add Allure Reporting

Compare
Choose a tag to compare
@ElSnoMan ElSnoMan released this 26 Oct 18:57
· 17 commits to main since this release
6552bd9

v1.17.2 - 2022.10.26

Overview

💡 Contributing to Pylenium is even easier now that you can use Gitpod - by @ElSnoMan in #290

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

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:

  1. 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
  2. Run tests

    • It's just pytest, but now add where you want the allure results to be saved:
       pytest --alluredir=allure-report
  3. 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)

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 and pyc fixtures are for!

  • The recommended py fixture is an instance of Pylenium for each test function which also comes with py_config which is the configuration for each test function

     from pylenium.driver import Pylenium
    
     def test_function(py: Pylenium):
     	py.visit("https://qap.dev")
     	...
  • pys and pys_config are used if you want a single Pylenium instance for the entire Test Session

     from 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 and pyc_config are used if you want a single Pylenium instance for an entire Test Class

     from 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 👏🏽

Full Changelog: v1.16.0...v1.17.0