Generate simple HTML report for your test/automation scripts in Python

automation-report  is PyPI package that generates the HTML report for your Python automation script with valid status of overall test case and its steps.


pip install automation-report

Sample Code: 

Importing package
from import AutomationReport

Passing optional 'options' dictionary as parament with following keys
  • LogoImage : Provide URL of the image 
  • MainHeader: When header text is to be used instead of logo 
  • FooterContent: Provide HTML content to add on the footer section
options = {}
#options["LogoImage"] = "logo.png"
options["MainHeader"] = "Automation Report"
options["FooterContent"] = "<a href='#'>Link</a>" 

Create new object for your first test with Report name and optional "options" dictionary
new_report = AutomationReport("Login Test", options)

Use starttest() method to start a new case with its name given as parameter
new_report.starttest("CASE 0001: Login to the system")

Populate the various steps status with info(), success(), fail() methods for particular case"Entered email in email field")
new_report.success("Login Successfully:")

End above started case

Create yet another case as following
new_report.starttest("CASE 0002: Logout User")"User is logged in")
new_report.success("Logout link is present")"User not logged out")

Use close method to finally complete the whole report generation


Find the source code: Github

Post a Comment