Skip to content

Teams Target Reference ​

Send test results to Microsoft Teams channels using incoming webhooks.

Prerequisites ​

Create a Microsoft Teams incoming webhook URL by following the official Microsoft documentation.

Configuration ​

Basic Configuration ​

json
{
  "name": "teams",
  "inputs": {
    "url": "<teams-incoming-webhook-url>"
  }
}

Complete Configuration ​

json
{
  "name": "teams",
  "condition": "fail",
  "inputs": {
    "url": "<teams-incoming-webhook-url>",
    "publish": "test-summary",
    "only_failures": false,
    "title": "Custom Test Results",
    "title_link": "https://ci.example.com/build/123",
    "title_suffix": " - Production",
    "max_suites": 15,
    "width": "Full"
  }
}

Properties ​

PropertyTypeDescriptionDefault
urlstringTeams incoming webhook URLRequired
publishstringReport type to publish"test-summary"
only_failuresbooleanShow only failed testsfalse
titlestringCustom report titleAuto-generated
title_linkstringClickable link on titleNone
title_suffixstringText appended to titleNone
max_suitesnumberMaximum suites to display10
widthstringMessage width controlDefault

Report Types ​

test-summary ​

Complete test results with suite breakdown and metrics.

Single Test Suite:Single Suite

Multiple Test Suites:Multiple Suites

test-summary-slim ​

Condensed results without suite details. Perfect for keeping primary channels clean.

Slim Summary

failure-details ​

Detailed information about failed tests including error messages and stack traces.

Failure Details

Width Options ​

WidthDescription
DefaultStandard message width
"Full"Full-width message layout

Command Line Usage ​

Basic Usage ​

bash
npx testbeats@latest publish \
  --teams '<webhook-url>' \
  --junit '<report-path>'

With Options ​

bash
npx testbeats@latest publish \
  --teams '<webhook-url>' \
  --junit '<report-path>' \
  --api-key '<api-key>'

Configuration File Examples ​

Development Team Channel ​

json
{
  "targets": [
    {
      "name": "teams",
      "condition": "fail",
      "inputs": {
        "url": "<dev-channel-webhook>",
        "publish": "failure-details",
        "title": "🚨 Test Failures",
        "only_failures": true,
        "width": "Full"
      }
    }
  ]
}

Management Dashboard ​

json
{
  "targets": [
    {
      "name": "teams",
      "inputs": {
        "url": "<management-channel-webhook>",
        "publish": "test-summary-slim",
        "title": "📊 Daily Test Report"
      }
    }
  ]
}

Multiple Environments ​

json
{
  "targets": [
    {
      "name": "teams",
      "inputs": {
        "url": "<staging-webhook>",
        "title_suffix": " - Staging Environment"
      }
    },
    {
      "name": "teams",
      "inputs": {
        "url": "<production-webhook>",
        "title_suffix": " - Production Environment",
        "publish": "test-summary-slim",
        "width": "Full"
      }
    }
  ]
}

Extensions Support ​

Teams targets support all TestBeats extensions:

Troubleshooting ​

Common Issues ​

Webhook URL not working:

  • Verify the webhook URL is correct and active
  • Test the webhook URL manually using curl
  • Check Teams connector permissions

Messages not appearing:

  • Ensure the connector is properly configured in Teams
  • Verify the webhook is associated with the correct team/channel
  • Check Teams' rate limiting

Formatting issues:

  • Verify special characters are properly escaped
  • Check message size limits
  • Ensure JSON payload is valid

Testing Configuration ​

bash
# Test with minimal configuration
npx testbeats@latest publish \
  --teams '<webhook-url>' \
  --junit '<sample-report>' \
  --verbose

Webhook Setup Guide ​

  1. Open Microsoft Teams and navigate to your target channel
  2. Click the three dots next to the channel name
  3. Select "Connectors" from the dropdown menu
  4. Find "Incoming Webhook" and click "Configure"
  5. Provide a name for your webhook (e.g., "TestBeats")
  6. Upload an icon (optional)
  7. Click "Create" to generate the webhook URL
  8. Copy the webhook URL and use it in your TestBeats configuration

Released under the MIT License.