This Python script interacts with the Report Portal API to fetch and analyze test execution launches. It provides various output formats and filtering capabilities to help monitor and analyze test results.
- Fetch launches from Report Portal with advanced filtering
- Multiple output formats:
- Table format (default)
- CSV format
- Summary format
- Failed test case retrieval with links
- Attribute-based filtering
- Caching support to improve performance
- Configurable through environment variables or config file
- Python 3.6 or higher
- Required Python packages (install via pip):
pip install -r requirements.txt
The script can be configured in two ways:
- Using a
config.json
file - Using environment variables
{
"base_url": "https://your-reportportal-instance",
"token": "your-api-token"
}
REPORT_PORTAL_URL
: Base URL of your Report Portal instanceREPORT_PORTAL_TOKEN
: Your Report Portal authentication token
Basic filtering for project:
python report_alert.py PROW
Disable SSL verification:
python report_alert.py PROW --no-verify
With --attr filters:
python report_alert.py PROW --attr version_installed=4.12.0-0.nightly-2025-01-25-135326
View failed test cases:
python report_alert.py PROW --status FAILED
With --attr, --test-name(-tn) and --status(-s) filters:
python ./report_alert.py prow --attr version_installed=4.12.0-0.nightly-2025-01-25-135326 --test-name installer --status FAILED
With filters --attr, --test-name(-tn), --status(-s) and excluding --name(-n) filters:
python ./report_alert.py prow --attr version_installed=4.12.0-0.nightly-2025-01-25-135326 --test-name nstaller --status FAILED -n automated-release
PROJECT
: (Required) Project name in Report Portal, only the name of the project is passed, it has no preceeding flag--token
: Authentication token (overrides config file)-n, --name
: Filter launches by name (partial match)-s, --status
: Filter launches by status (PASSED, FAILED, STOPPED, INTERRUPTED, IN_PROGRESS)-t, --tags
: Filter launches by tags--start-from
: Fetch launches from this date (YYYY-MM-DD)--start-to
: Fetch launches up to this date (YYYY-MM-DD)--attr
: Filter by attributes in KEY=VALUE format-p, --page
: Page number (default: 1)-l, --limit
: Number of launches per page (default: 20)-o, --output
: Output format (json, table, summary, detailed)--failed-tests
: Fetch failed test cases with links from launches-tn, --test-name
: Filter launches by test name--reset-cache
: Clear the cache and fetch fresh data--cache-hours
: Cache expiry time in hours (default: 24)--no-verify
: Will disable SSL verification
-
Table Format (Default)
- Displays launches in a formatted table
- Shows Suite Name, Test Name, Status, Test URL
-
CSV Format
- Creates a CSV for all the failed tests
- Includes Suite Name, Test Name, Status, Test URL
-
Summary Format
- Gives a summary of Failed Tests, Suites and Launches
The script implements caching to improve performance:
- Cache duration: 24 hours by default
- Cache location:
~/.reportportal_cache
- Use
--reset-cache
to clear existing cache - Configure cache duration with
--cache-hours