Skip to main content

No project description provided

Project description

Pytest plugin for additional test reporting

PyPI license PyPI version PyPI downloads Travis Build Coverage Status

Offers additional 2 reporting options:

  • Skipped tests percentage
  • (For Selenium tests) HTML Coverage report

These two functionalities are not related and can be used separately. At the time, it's just easier to have them in the same codebase. Both of them have the option to output the report in terminal or Confluence.

Skipped test percentage

To execute it:

$ pytest demo --track terminal
============== test session starts ===================
plugins: track-0.1.0
collected 7 items

demo/test_models.py .s.s.                       [ 71%]
demo/test_views.py .s                           [100%]

======= 4 passed, 3 skipped in 0.02 seconds ==========
Total: 4 from 7 tests not skipped (57.14%)
    test_models, 3 from 5 tests not skipped (60.00%)
    test_views, 1 from 2 tests not skipped (50.00%)

Current functionality requires only test collection so this can be used with pytest's --collect-only

To store result in Confluence, see the Confluence Configuration section and use:

$ pytest --track confluence

HTML Coverage

To have this you need both to have selenium tests and access to the HTML source for the project you want to compute coverage.

This plugin works by recording all the identifiable source code elements in the HTML source and comparing how many of them the selenium tests view and inspect.

In greater details this is doing:

  1. In the plugin configure phase, read HTML files and create a simple tree with identifiable elements

    • This step can be cached (See options)
    • Identifiable elements is a tag with an id or a class or aa special HTML tag (app- for Angular)
  2. While tests run, on each Selenium driver URL get, record the received HTML as viewed

  3. While tests run, on each Selenium driver find_element, record the element as inspected

  4. In the plugin unconfigure phase, calculate a naive % HTML seen and % HTML inspected

    $ pytest --html-cov terminal --html-cov-dir=<directory_with_HTML_source>

    To cache HTML source parse set, use

    $ pytest --html-cov --html-cov-cache

    To also report missing elements, use

    $ pytest --html-cov --html-cov-show-elements

To store result in Confluence, see the Confluence Configuration section and use:

$ pytest --html-cov confluence

Confluence reporting

To configure Confluence settings add a section to pytest.ini

[pytest_track]
track_confluence_username=<confluence_username>
track_confluence_password=<confluence_password>
track_confluence_url=<confluence_root_url>
# For skipped test percentage
confluence_report_parent_page_id=<id_of_the_parent_page>
confluence_report_page_title=<title_for_the_results_page>
# For HTML coverage
confluence_coverage_parent_page_id=<id_of_the_parent_page>
confluence_coverage_page_title=<title_for_the_results_page>

Contrib

Before PRs, only:

pre-commit install
tox

Acknowledgements

Based on the initial work of Vasilica Dumbrava.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-track-0.1.3.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_track-0.1.3-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest-track-0.1.3.tar.gz.

File metadata

  • Download URL: pytest-track-0.1.3.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.12

File hashes

Hashes for pytest-track-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6f93a3516be2fe303bc3110c845656e1ddafa3e48ac036422a228104bd0f9415
MD5 729f882282e4db2b3a3548943fe1abb7
BLAKE2b-256 3efe97551909e97295777d7caed3221a700a781f75f1c4460625a53d13025e19

See more details on using hashes here.

File details

Details for the file pytest_track-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pytest_track-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.12

File hashes

Hashes for pytest_track-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b8edc02d1adde1ec745de64bde89052773ccd4dc19f7e2fe6e12448389a9e376
MD5 8abd4d0d6a8ae76ca80c09211b53bb77
BLAKE2b-256 f0cfc3b412977f891f68dea9520fa0ac090119f840c2bcb4bf839e32770d1143

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page