Skip to main content

A PyTest Reporter to send test runs to Notion.so

Project description

notion-pytest-reporter

A PyTest Reporter to send test runs to Notion.so and enable bi-directional traceability.

Example Test Cycle Report Test Cycle Report - Shows Test Execution Results from run

Example Test Execution Test Execution - Shows Stack trace if failed

Example Test Case Test Case - Shows Test Executions

How it works

notion-pytest-reporter uses the unofficial Notion API to create new items in the Test collection templates found here: Test Report Template

For every test run notion-pytest-reporter will create a new Test Cycle and within the Test Cycle create a Test Execution.

The Test Execution can be linked to a Test Case using the @pytest.mark.notion_test(test_name) decorator with the test_name argument being the title of the test case.

If a Test Case has been linked to a Test Execution then the Test Case page will be updated to show that Test Execution allowing for bi-directional traceability between the executed test and the test case.

If the Test Case is linked to a user story or specification then you'll have bi-directional traceability between the tests and the user story!

Running the reporter

The reporter takes the following arguments:

Argument Description
--notion-token API token used to authenticate with Notion
--test-cycle-url URL of the Test Cycle collection
--test-case-url URL of the Test Case collection
--test-execution-url URL of the Test Execution collection
--test-cycle-name Name to use for the Test Cycle

All arguments execpt --test-cycle-name are required for the reporter to run.

Getting the Authentication Token and collections URLS

In order to get the authentication token used by the test reporter you'll need to use the web version of Notion.

Once you've logged into Notion open the inspector panel on your web browser and locate the cookie named token_v2 - the value stored in that cookie is authentication token.

The Test Cycle and Test Case URLs are simpler to extract.

Right click the Test Cycle page in the side navigation and select Copy Link to get the URL for the Test Cycle collection.

Right click the Test Cases page in the side navigation and select Copy Link to get the URL for the Test Cases collection.

Right click the Test Executions page in the side navigation and select Copy Link to get the URL for the Test Executions collection.

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-notion-1.0.1.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file pytest-notion-1.0.1.tar.gz.

File metadata

  • Download URL: pytest-notion-1.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for pytest-notion-1.0.1.tar.gz
Algorithm Hash digest
SHA256 79bef72c32ea3bc3684ac460b7686168a54c39737bdd872f2896c48d4b44667e
MD5 827e92910ac41a60286b59734254452c
BLAKE2b-256 4a313ef409fd5cffd517a8f6ba12275a0c21e6723604e4d51029a4d4c74ac7e8

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