qxf2 / qxf2-page-object-model

Write Selenium and Appium tests in Python using the Page Object pattern. This Pythonic GUI and API test automation framework will help you get started with QA automation quickly. It comes with many useful integrations like - email, BrowserStack, Slack, TestRail, etc. This repository is developed and maintained by Qxf2 Services.
https://qxf2.com
MIT License
262 stars 191 forks source link

Refactor Logging Object and simplify logging implementation #479

Open shivahari opened 1 month ago

shivahari commented 1 month ago

The logging implementation currently looks like this:

existing_logging_implementation

The LoggingObject object reads the logging configuration from the BaseLogging object through composition, the LoggingObject is then inherited into BasePage.

The problem with this approach is that the pytest logs for test collection and failure summary is not present in the log file. The implementation also conflicts with SOLID object oriented design principles.

Modify the implementation to look like this:

simplified_logging_implementation drawio

The pytest logging fixture - caplog should create an instance of the LoggingObject, this instance then should be used in BasePage through composition. This way, the pytest logs are also captured in the log files and the LoggingObject becomes more cleaner.