testbeats publish ​
Publish test results to configured targets like Slack, Microsoft Teams, Google Chat, and more.
Synopsis ​
bash
npx testbeats publish [options]
npx testbeats publish -c <config-file>
Description ​
The publish
command reads test results from files and sends them to configured communication platforms. It supports two modes:
- CLI Mode: Configure everything through command-line arguments
- Configuration Mode: Use a JSON configuration file for complex setups
Options ​
General Options ​
Option | Description | Default |
---|---|---|
-c, --config <path> | Path to configuration file | .testbeats.json |
-h, --help | Display help information | - |
-v, --verbose | Enable verbose logging | false |
Portal Options ​
Option | Description | Required |
---|---|---|
--api-key <key> | TestBeats API key for portal features | No |
--project <name> | Project name for portal organization | No |
--run <name> | Custom run name for this execution | No |
Target Options ​
Option | Description | Required |
---|---|---|
--slack <url> | Slack incoming webhook URL | No |
--teams <url> | Microsoft Teams incoming webhook URL | No |
--chat <url> | Google Chat incoming webhook URL | No |
Result Format Options ​
Option | Description | Required |
---|---|---|
--junit <path> | Path to JUnit XML reports | No |
--cucumber <path> | Path to Cucumber JSON reports | No |
--mocha <path> | Path to Mocha JSON reports | No |
--testng <path> | Path to TestNG XML reports | No |
--xunit <path> | Path to XUnit XML reports | No |
--nunit <path> | Path to NUnit XML reports | No |
--mstest <path> | Path to MSTest XML reports | No |
Extension Options ​
Option | Description | Default |
---|---|---|
--ci-info | Include CI/CD environment information | false |
--chart-test-summary | Include visual test summary chart | false |
Examples ​
Basic Usage ​
Publish JUnit results to Slack:
bash
npx testbeats publish --slack "https://hooks.slack.com/..." --junit "test-results/*.xml"
With Portal Integration ​
Include TestBeats API key for portal features:
bash
npx testbeats publish \
--api-key "api-key" \
--slack "https://hooks.slack.com/..." \
--junit "test-results/*.xml"
Multiple Targets ​
Send results to both Slack and Teams:
bash
npx testbeats publish \
--slack "https://hooks.slack.com/..." \
--teams "https://outlook.office.com/webhook/..." \
--junit "test-results/*.xml"
With Extensions ​
Include CI information and test summary chart:
bash
npx testbeats publish \
--ci-info \
--chart-test-summary \
--slack "https://hooks.slack.com/..." \
--junit "test-results/*.xml"
Using Configuration File ​
Create a configuration file and use it:
bash
npx testbeats publish -c testbeats.config.json
With Environment Variables ​
Use environment variables for sensitive data:
bash
export TEST_BEATS_API_KEY="api-key"
export SLACK_WEBHOOK_URL="https://hooks.slack.com/..."
npx testbeats publish --slack "$SLACK_WEBHOOK_URL" --junit "results/*.xml"
Configuration File Mode ​
For complex configurations, use a JSON file:
json
{
"api_key": "api-key",
"targets": [
{
"name": "slack",
"inputs": {
"url": "https://hooks.slack.com/..."
},
"extensions": [
{
"name": "ci-info"
},
{
"name": "chart-test-summary"
}
]
}
],
"results": [
{
"type": "junit",
"files": ["test-results/*.xml"]
}
]
}
Environment Variables ​
These environment variables are automatically used:
Variable | Description | CLI Equivalent |
---|---|---|
TEST_BEATS_API_KEY | TestBeats API key | --api-key |
TEST_BEATS_CONFIG | Configuration file path | --config |
File Path Patterns ​
Result file paths support glob patterns:
results/*.xml
- All XML files in results directory**/junit-*.xml
- All files matching pattern recursivelytest-results/junit-results.xml
- Specific file["results/*.xml", "reports/*.json"]
- Multiple patterns (config file only)
See Also ​
- Configuration Reference - Complete configuration schema
- Targets Reference - Communication platform setup
- Extensions Reference - Available extensions