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 ​
Property | Type | Description | Default |
---|---|---|---|
url | string | Teams incoming webhook URL | Required |
publish | string | Report type to publish | "test-summary" |
only_failures | boolean | Show only failed tests | false |
title | string | Custom report title | Auto-generated |
title_link | string | Clickable link on title | None |
title_suffix | string | Text appended to title | None |
max_suites | number | Maximum suites to display | 10 |
width | string | Message width control | Default |
Report Types ​
test-summary ​
Complete test results with suite breakdown and metrics.
Single Test Suite:
Multiple Test Suites:
test-summary-slim ​
Condensed results without suite details. Perfect for keeping primary channels clean.
failure-details ​
Detailed information about failed tests including error messages and stack traces.
Width Options ​
Width | Description |
---|---|
Default | Standard 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:
- Mentions - Tag team members
- Hyperlinks - Add clickable links
- Metadata - Include build information
- CI Info - Show CI/CD context
- Chart Test Summary - Visual charts
- Report Portal Analysis - ReportPortal integration
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 ​
- Open Microsoft Teams and navigate to your target channel
- Click the three dots next to the channel name
- Select "Connectors" from the dropdown menu
- Find "Incoming Webhook" and click "Configure"
- Provide a name for your webhook (e.g., "TestBeats")
- Upload an icon (optional)
- Click "Create" to generate the webhook URL
- Copy the webhook URL and use it in your TestBeats configuration
Related ​
- Slack Target - Slack integration
- Chat Target - Google Chat integration
- Extensions - Enhance Teams messages
- Conditions - Control when to send messages