Skip to main content

CLI Reporter

Upload CTRF test reports to Testream from any CI provider using the CLI.

What you need

  • Testream API key (from testream.app → Settings → API Keys)
  • A CTRF report that you want to upload. Check out https://ctrf.io/ for generating CTRF reports from your test runs.

GitHub Actions

Use the action for the easiest setup in GitHub Actions.

.github/workflows/tests.yml
name: Tests

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- run: npm ci
- run: npx playwright test

- name: Upload to Testream
if: always()
uses: testream/upload-action@latest
with:
report-path: ctrf/ctrf-report.json
api-key: ${{ secrets.TESTREAM_API_KEY }}

Action inputs

InputRequiredDefaultDescription
report-pathYes-Path to CTRF report JSON file
api-keyYes*-Testream API key (*required unless no-upload is true)
test-toolYes-Test tool name (e.g., playwright, jest, cypress, dotnet)
branchNoautoGit branch name
commit-shaNoautoGit commit SHA
repository-urlNoautoGit repository URL
build-nameNoautoBuild name/identifier
build-numberNoautoBuild number
build-urlNoautoBuild URL
test-environmentNo-Environment name (e.g., ci, staging)
app-nameNo-Application name
app-versionNo-Application version
test-typeNo-Test type (e.g., unit, e2e)
no-uploadNofalseSkip upload (validate + summarize only)
fail-on-errorNotrueFail the action if upload fails

CLI (Any CI provider)

Use the CLI in CircleCI, Bitbucket Pipelines, GitLab, Jenkins, Azure Pipelines, or local scripts.

npx @testream/upload-action \
--report-path ctrf/ctrf-report.json \
--test-tool playwright \
--api-key $TESTREAM_API_KEY

CLI options

OptionDescription
-r, --report-path <path>Required Path to CTRF report JSON file
-k, --api-key <key>Required API key for authentication
--test-tool <name>Required Test tool name (e.g., playwright, jest, cypress, dotnet)
-b, --branch <name>Git branch name
-c, --commit-sha <sha>Git commit SHA
-u, --repository-url <url>Git repository URL
--build-name <name>Build name/identifier
--build-number <num>Build number
--build-url <url>Build URL
--test-environment <env>Test environment (e.g., ci, staging)
--app-name <name>Application name
--app-version <ver>Application version
--test-type <type>Test type (e.g., unit, e2e)
--no-uploadSkip uploading (validate + summarize only)
--fail-on-errorExit with non-zero code if upload fails

CircleCI example

.circleci/config.yml
version: 2.1

jobs:
test:
docker:
- image: mcr.microsoft.com/playwright:latest
steps:
- checkout
- run: npm ci
- run: npx playwright test
- run:
name: Upload to Testream
command: |
npx @testream/upload-action \
--report-path ctrf/ctrf-report.json \
--test-tool playwright \
--api-key $TESTREAM_API_KEY \
--branch $CIRCLE_BRANCH \
--commit-sha $CIRCLE_SHA1 \
--repository-url $CIRCLE_REPOSITORY_URL \
--build-number $CIRCLE_BUILD_NUM \
--build-url $CIRCLE_BUILD_URL \
--test-environment ci

Bitbucket Pipelines example

bitbucket-pipelines.yml
image: mcr.microsoft.com/playwright:latest

pipelines:
default:
- step:
name: Tests
script:
- npm ci
- npx playwright test
- |
npx @testream/upload-action \
--report-path ctrf/ctrf-report.json \
--test-tool playwright \
--api-key $TESTREAM_API_KEY \
--branch $BITBUCKET_BRANCH \
--commit-sha $BITBUCKET_COMMIT \
--repository-url $BITBUCKET_GIT_HTTP_ORIGIN \
--build-number $BITBUCKET_BUILD_NUMBER \
--build-url "https://bitbucket.org/${BITBUCKET_REPO_FULL_NAME}/pipelines/results/${BITBUCKET_BUILD_NUMBER}" \
--test-environment ci

Other CI providers

Use the same CLI options in GitLab, Jenkins, Azure Pipelines, or any custom runner. If you already have a CTRF report, the CLI is all you need.

NPM package

What's Next?