@releaseqa/cli
v1.0.2
Published
ReleaseQA CLI - Report test results from any framework via JUnit XML or JSON
Downloads
369
Maintainers
Readme
@releaseqa/cli
Command-line tool for reporting test results to ReleaseQA from any test framework. Supports JUnit XML and JSON formats.
Installation
npm install --save-dev @releaseqa/cliOr use directly with npx:
npx @releaseqa/cli report --format junit --file ./test-results.xmlQuick Start
# Set your API key
export RELEASEQA_API_KEY=rqa_your_key_here
# Report JUnit XML results
npx @releaseqa/cli report --format junit --file ./test-results.xml
# Report JSON results
npx @releaseqa/cli report --format json --file ./results.jsonCommands
report
Report test results to ReleaseQA.
releaseqa report [options]Options:
| Option | Description |
|--------|-------------|
| -f, --format <type> | Result format: junit or json (required) |
| --file <path> | Path to results file (required) |
| -p, --project <name> | Project name (auto-detected if not provided) |
| -t, --tags <tags> | Comma-separated tags |
| --api-key <key> | API key (defaults to RELEASEQA_API_KEY env var) |
| --base-url <url> | API base URL (for self-hosted) |
| --debug | Enable debug output |
version
Print CLI version.
releaseqa versionSupported Formats
JUnit XML
The standard JUnit XML format, supported by most test frameworks:
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="Test Results" tests="10" failures="2" time="5.5">
<testsuite name="auth.spec.ts" tests="5" failures="1" time="2.5">
<testcase name="should login successfully" classname="auth" time="0.5"/>
<testcase name="should show error on invalid password" classname="auth" time="1.0">
<failure message="Expected error message to be visible"/>
</testcase>
</testsuite>
</testsuites>Frameworks that output JUnit XML:
- pytest (
--junitxml=results.xml) - Go test (
go test -v 2>&1 | go-junit-report) - PHPUnit (
--log-junit results.xml) - RSpec (
--format RspecJunitFormatter) - JUnit (natively)
- TestNG (natively)
JSON
ReleaseQA native JSON format:
{
"project": "my-app",
"results": [
{
"testSuite": "auth.spec.ts",
"testCase": "should login successfully",
"status": "passed",
"duration": 500
},
{
"testSuite": "auth.spec.ts",
"testCase": "should show error on invalid password",
"status": "failed",
"duration": 1000,
"errorMessage": "Expected error message to be visible"
}
]
}CI Examples
GitHub Actions
- name: Run tests
run: npm test -- --reporter junit --outputFile results.xml
- name: Report to ReleaseQA
run: npx @releaseqa/cli report --format junit --file results.xml
env:
RELEASEQA_API_KEY: ${{ secrets.RELEASEQA_API_KEY }}
if: always()GitLab CI
test:
script:
- npm test -- --reporter junit --outputFile results.xml
after_script:
- npx @releaseqa/cli report --format junit --file results.xml
variables:
RELEASEQA_API_KEY: $RELEASEQA_API_KEYCircleCI
- run:
name: Run tests
command: npm test -- --reporter junit --outputFile results.xml
- run:
name: Report to ReleaseQA
command: npx @releaseqa/cli report --format junit --file results.xml
when: alwaysPiping from stdin
You can also pipe results directly:
cat test-results.xml | npx @releaseqa/cli report --format junit
npm test -- --json | npx @releaseqa/cli report --format jsonEnvironment Variables
| Variable | Description |
|----------|-------------|
| RELEASEQA_API_KEY | Your ReleaseQA API key |
| RELEASEQA_PROJECT | Default project name |
| RELEASEQA_BASE_URL | Custom API URL |
License
MIT
