clevertest-cli
v1.1.0
Published
CLI tool to submit xUnit/JUnit test automation results to CleverTest from CI/CD pipelines
Maintainers
Readme
clevertest-cli
Submit xUnit/JUnit test automation results to CleverTest from your CI/CD pipeline.
Install
npm install -g clevertest-cliOr run without installing:
npx clevertest-cli submit ...Usage
clevertest-cli submit \
--token clt_your_token_here \
--project-id your_project_id \
--results reports/junit.xml \
--source "jest"With a milestone and glob pattern for multiple files:
clevertest-cli submit \
--token clt_your_token_here \
--project-id your_project_id \
--milestone-id your_milestone_id \
--results "reports/**/*.xml" \
--name "Nightly suite" \
--source "github-actions"Options
| Flag | Required | Description |
|---|---|---|
| --token | yes | API token from Project Settings → API Tokens |
| --project-id | yes | CleverTest project ID (visible in the project URL) |
| --results | yes | Path or glob to xUnit XML file(s) |
| --source | no | Source label, e.g. "jest", "github-actions" |
| --milestone-id | no | Associate results with a milestone |
| --name | no | Custom run name (defaults to the file name) |
| --link | no | Attach a link to the run. Use "Label=https://…" or a bare URL. Repeat the flag for multiple links. |
| --api-url | no | Override API URL (default: https://clevertest.pro) |
Supported formats
JUnit (Maven Surefire), pytest, Jest, Vitest, PHPUnit, NUnit 2, NUnit 3, TestNG, xUnit.net.
CI examples
GitHub Actions
- name: Submit test results
if: always()
run: |
npx clevertest-cli submit \
--token ${{ secrets.CLEVERTEST_TOKEN }} \
--project-id ${{ vars.CLEVERTEST_PROJECT_ID }} \
--results "reports/**/*.xml" \
--source "github-actions" \
--link "GitHub Actions=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
--link "Commit=${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}"The --link flags surface as clickable chips in the CleverTest run detail page and in the exported HTML report.
GitLab CI
submit-results:
stage: test
script:
- npx clevertest-cli submit
--token $CLEVERTEST_TOKEN
--project-id $CLEVERTEST_PROJECT_ID
--results "reports/**/*.xml"
--source "gitlab-ci"Exit codes
0— all submitted tests passed1— one or more tests failed, or an error occurred during submission
This makes it safe to use as the last step in a CI job — a red build stays red if tests failed.
Generating an API token
- Open your project in CleverTest.
- Go to Project Settings → API Tokens.
- Click Generate token, give it a label (e.g.
GitHub Actions CI). - Copy the token immediately — it won't be shown again.
- Store it as a CI secret (e.g.
CLEVERTEST_TOKEN).
License
MIT
