Skip to content

testream/pytest-jira-reporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pytest Jira Reporter: Send Pytest Test Results to Jira with Testream

This repository is a practical Pytest + Jira integration example using @testream/pytest-reporter. It shows how to run Pytest locally and in GitHub Actions, then upload test results to Testream so they appear in Jira.

If you are searching for "Pytest Jira reporter", "Pytest GitHub Actions Jira integration", or "send Pytest test results to Jira", this repo is the implementation template.

Why this example is useful

  • Python-first setup: Uses a standard Python project layout (src/, tests/, requirements.txt).
  • CI-ready: Includes a working GitHub Actions workflow.
  • Real triage flow: Intentional failing tests demonstrate how failures surface in Testream/Jira.
  • Secure secrets handling: Workflow uses secrets.TESTREAM_API_KEY (no hardcoded API keys).

What is Testream?

Testream is an automated test management and reporting platform for Jira teams. It ingests test results from frameworks like Pytest, Cypress, Playwright, Jest, and Vitest, then provides failure analysis, trends, and release visibility inside Jira.

If this sample repository is not the framework you need, browse all native reporters in the Testream docs: https://docs.testream.app/.

Watch Testream in action

Click to see how Testream turns raw CI test results into actionable Jira insights (failures, trends, and release visibility):
Watch the video

Install the Testream Automated Test Management and Reporting for Jira app in your Jira workspace to view uploaded runs.

Project structure

src/
  cart.py            - Cart logic
  discount.py        - Discount utilities
  product.py         - Product model
tests/
  test_cart.py       - Passing tests + 1 intentional failure
  test_discount.py   - Passing tests + 1 intentional failure
  test_product.py    - Passing tests + 1 intentional failure
  conftest.py        - Import path bootstrap for src/
.github/workflows/pytest.yml
requirements.txt
pytest.ini
.env.example

The intentional failures exist so you can verify how errors are shown in Testream/Jira.

Quick start: Pytest to Jira reporting

1. Create your Testream project and API key

  1. Sign in at testream.app.
  2. Create a project.
  3. Copy your API key.

2. Install dependencies

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

3. Configure environment variables

cp .env.example .env
source .env

Set at least:

TESTREAM_API_KEY=<your key>

4. Run Pytest and upload with Testream reporter

npx @testream/pytest-reporter \
  -k "$TESTREAM_API_KEY" \
  --test-environment local \
  --app-name pytest-jira-reporter-example \
  --test-type unit

Without an API key, you can still run tests directly:

python -m pytest

Reporter configuration

This sample uses the CLI flow from @testream/pytest-reporter. The command:

  1. Runs pytest
  2. Writes JUnit XML
  3. Converts to CTRF
  4. Uploads to Testream

Reporter docs: https://docs.testream.app/reporters/pytest

GitHub Actions setup

The workflow at .github/workflows/pytest.yml runs on push, pull request, and manual dispatch.

Add this repository secret:

Settings -> Secrets and variables -> Actions -> New repository secret

Name Value
TESTREAM_API_KEY Your Testream API key

The workflow uses:

  • TESTREAM_API_KEY: ${{ secrets.TESTREAM_API_KEY }}
  • TESTREAM_APP_VERSION equivalent via ${{ github.sha }}
  • TEST_ENV equivalent via --test-environment ci

How Pytest results appear in Jira

After connecting your Testream project to Jira, you get:

  • Dashboard views for pass/fail health
  • Failed test details with stack traces
  • Trend analytics across runs
  • Jira issue creation from failures with context included

Troubleshooting

Uploads not showing from local runs

  • Ensure TESTREAM_API_KEY is set in your shell.
  • Re-source .env if values changed.

Uploads not showing from GitHub Actions

  • Confirm TESTREAM_API_KEY exists in repository secrets.
  • For fork PRs, check whether secrets are available to workflow runs.

Why does CI fail in this sample?

This sample includes intentional failing tests for demonstration. Remove or fix those tests when you want fully green pipelines.

FAQ

Is this production-ready?

It is an example designed to be copied and adapted. The workflow and secret handling are production-oriented.

Why include failing tests?

They demonstrate failure triage in Jira/Testream.

Can I run Pytest without Testream?

Yes. Run python -m pytest and skip the reporter command.

Related links

Contributors

Languages