Skip to content

pytest Reporter ​

The UTEM pytest reporter streams test results to the UTEM server in real time. Zero external dependencies — uses only the Python standard library. Auto-discovered by pytest with no configuration needed.

Installation ​

bash
pip install utem-pytest-reporter

Usage ​

Once installed the plugin is auto-discovered — no changes to conftest.py or pytest.ini needed.

bash
UTEM_SERVER_URL=http://localhost:8080/utem pytest

Or via CLI option:

bash
pytest --utem-url=http://localhost:8080/utem

Configuration ​

utem.config.json ​

Create utem.config.json in your project root:

json
{
  "serverUrl": "http://myserver:8080/utem",
  "runName": "My Test Suite",
  "runLabel": "regression",
  "jobName": "nightly",
  "disabled": false
}

Environment Variables ​

bash
UTEM_SERVER_URL=http://myserver:8080/utem \
UTEM_RUN_NAME="My Suite" \
UTEM_RUN_LABEL=regression \
pytest

All options ​

Env VariableCLIJSON keyDescriptionDefault
UTEM_SERVER_URL--utem-urlserverUrlUTEM server URLhttp://localhost:8080/utem
UTEM_RUN_NAME—runNameRun nameSession name
UTEM_RUN_LABEL—runLabelTag (e.g. regression)—
UTEM_JOB_NAME—jobNameCI job name—
UTEM_DISABLED—disabledSet true to disablefalse

Priority: CLI → Environment variable → utem.config.json → default

Screenshot Support (Selenium) ​

Register your WebDriver in a fixture:

python
import pytest
import utem_pytest_reporter

@pytest.fixture(autouse=True)
def utem_driver(driver):
    utem_pytest_reporter.register_driver(driver)
    yield
    utem_pytest_reporter.unregister_driver()

Screenshots are automatically captured on failure and attached in the dashboard.

CI Integration ​

GitHub Actions ​

yaml
- name: Run pytest
  run: pytest
  env:
    UTEM_SERVER_URL: http://your-utem-server:8080/utem
    UTEM_API_KEY: ${{ secrets.UTEM_API_KEY }}
    UTEM_RUN_NAME: "pytest - ${{ github.ref_name }}"
    UTEM_RUN_LABEL: regression

Disabling the Reporter ​

bash
UTEM_DISABLED=true pytest

What Gets Reported ​

pytest eventUTEM event
Session startTEST_RUN_STARTED
First test in a fileTEST_SUITE_STARTED
Each test startTEST_CASE_STARTED
Test passTEST_PASSED + TEST_CASE_FINISHED
Test failureTEST_FAILED + TEST_CASE_FINISHED
Test skipTEST_SKIPPED + TEST_CASE_FINISHED
Session endTEST_SUITE_FINISHED × N + TEST_RUN_FINISHED
Failure screenshotATTACHMENT + file upload

Requirements ​

  • Python 3.8+
  • pytest 7+

Released under the MIT License.