logo logo

Create Pytest HTML Test Reports

main post image

This tutorial will make web UI testing easy. We will build a simple yet robust web UI test solution using Python, pytest, and Selenium WebDriver. We will learn strategies for good test design as well as patterns for good automation code. By the end of the tutorial, you’ll be a web test automation champ! Your Python test project can be the foundation for your own test cases, too.

📍 If you are looking for a single Python Package for Android, iOS and Web Testing – there is also an easy open source solution provided by TestProject. With a single executable, zero configurations, and familiar Selenium APIs, you can develop and execute robust Python tests and get automatic HTML test reports as a bonus! All you need is: pip install testproject-python-sdk. Simply follow this Github link to learn more about it, or read through this great tutorial to get started.

Tutorial Chapters

  1. Set Your Test Automation Goals (Chapter 1)
  2. Create A Python Test Automation Project Using Pytest (Chapter 2)
  3. Installing Selenium WebDriver Using Python and Chrome (Chapter 3)
  4. Write Your First Web Test Using Selenium WebDriver, Python and Chrome (Chapter 4)
  5. Develop Page Object Selenium Tests Using Python (Chapter 5)
  6. How to Read Config Files in Python Selenium Tests (Chapter 6)
  7. Take Your Python Test Automation To The Next Level (Chapter 7)

When pytest runs at the command line, it sometimes prints an unhelpful wall of text. Visual reports are a much better way to consume test result information, especially for non-developers. Adding the pytest-html plugin to your test project enables you to print pretty HTML reports with one simple command line option.

Reports will look like this:

pytest-html Report

When it comes to Python and Selenium/Appium functional tests there is an easy open-source solution provided by TestProject that automatically creates the HTML and PDF reports for you (out of the box, no additional configuration needed). Simply follow this Github link to learn more about it, or read through this great tutorial to get started.

Reports will look like this:

TestProject Python SDK - Generated Test Reports - Detailed Steps

Go ahead and check out the next tip for taking your web UI testing with Python to the next level.

Avatar

About the author

AutomationPanda

Andy Knight is the “Automation Panda” – an engineer, consultant, and international speaker who loves all things software. He specializes in building robust test automation systems from the ground up. Read his tech blog at AutomationPanda.com, and follow him on Twitter at @AutomationPanda.

Join TestProject Community

Get full access to the world's first cloud-based, open source friendly testing community. Enjoy TestProject's end-to-end test automation Platform, Forum, Blog and Docs - All for FREE.

Join Us Now  

Comments

8 7 comments

Leave a Reply

FacebookLinkedInTwitterEmail