Skip to content

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 ​

OptionDescriptionDefault
-c, --config <path>Path to configuration file.testbeats.json
-h, --helpDisplay help information-
-v, --verboseEnable verbose loggingfalse

Portal Options ​

OptionDescriptionRequired
--api-key <key>TestBeats API key for portal featuresNo
--project <name>Project name for portal organizationNo
--run <name>Custom run name for this executionNo

Target Options ​

OptionDescriptionRequired
--slack <url>Slack incoming webhook URLNo
--teams <url>Microsoft Teams incoming webhook URLNo
--chat <url>Google Chat incoming webhook URLNo

Result Format Options ​

OptionDescriptionRequired
--junit <path>Path to JUnit XML reportsNo
--cucumber <path>Path to Cucumber JSON reportsNo
--mocha <path>Path to Mocha JSON reportsNo
--testng <path>Path to TestNG XML reportsNo
--xunit <path>Path to XUnit XML reportsNo
--nunit <path>Path to NUnit XML reportsNo
--mstest <path>Path to MSTest XML reportsNo

Extension Options ​

OptionDescriptionDefault
--ci-infoInclude CI/CD environment informationfalse
--chart-test-summaryInclude visual test summary chartfalse

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:

VariableDescriptionCLI Equivalent
TEST_BEATS_API_KEYTestBeats API key--api-key
TEST_BEATS_CONFIGConfiguration 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 recursively
  • test-results/junit-results.xml - Specific file
  • ["results/*.xml", "reports/*.json"] - Multiple patterns (config file only)

See Also ​

Released under the MIT License.