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

Print prettytable summary for failure #470

Closed shivahari closed 1 month ago

shivahari commented 1 month ago

Integrated prettytable failure summary to the framework as a pytest plugin. The TerminalReporter pytest plugin is overwritten with a CustomTerminalReported object to print the table summary. The prettytable is used only when there is a failure.

Changes tracked in the PR:

  1. Created a pytest plugin to print the failures in a table using prettytable
  2. Modified conftest.py file to get the failed scenarios from test objects and pass them on to the testreporter plugin
  3. Added a integrations/reporting_tools/prettytable_object.py module to configure the table used to print the test failure summary
shivahari commented 1 month ago

Please ignore the failed Codacy Static Analysis check, it complains about the test_obj fixture being too complex. We will be fixing it in https://github.com/qxf2/qxf2-page-object-model/issues/471

@rohandudam @Sravanti25

shivahari commented 1 month ago

@rohandudam @sravantit25 I have moved the prettytable_object from integrations/reporting_tools to core_helpers and I have created a module - custom_pytest_plugins and added it to core_helpers, I moved the CustomTerminalReporter object from conftest module to custom_pytest_plugins.

rohandudam commented 1 month ago

@shivahari Changes looks good. I ran tests for both positive and negative scenarios. I noticed failure summary is not included in test logs. Can we add it as part of test logs also? If yes, you can take call to make changes as part of this PR or you want to open new one. I am approving PR as of now.

shivahari commented 1 month ago

@shivahari Changes looks good. I ran tests for both positive and negative scenarios. I noticed failure summary is not included in test logs. Can we add it as part of test logs also? If yes, you can take call to make changes as part of this PR or you want to open new one. I am approving PR as of now.

The failure summary will not be present in the failure log just like how pytest logs are not printed in the test logs currently. This is a pytest plugin change.

The summary will appear on the log when we integrate our logging object with pytest.