Skip to main content
hitspec can send notifications to Slack and Microsoft Teams when tests complete. This is especially useful for CI/CD pipelines to alert teams about test failures.

Supported Services

ServiceFlagWebhook Variable
Slack--notify slackSLACK_WEBHOOK
Microsoft Teams--notify teamsTEAMS_WEBHOOK

Quick Start

# Notify Slack on failure
hitspec run tests/ \
  --notify slack \
  --slack-webhook "$SLACK_WEBHOOK"

# Notify Teams on failure
hitspec run tests/ \
  --notify teams \
  --teams-webhook "$TEAMS_WEBHOOK"

Notification Triggers

Control when notifications are sent with --notify-on:
ValueDescription
failureSend only when tests fail (default)
alwaysSend on every run
successSend only when all tests pass
recoverySend on failure and when tests recover from a previous failure
# Always notify
hitspec run tests/ --notify slack --slack-webhook "$SLACK_WEBHOOK" --notify-on always

# Notify on recovery (useful for monitoring)
hitspec run tests/ --notify slack --slack-webhook "$SLACK_WEBHOOK" --notify-on recovery

Slack Configuration

FlagEnv VarDescription
--slack-webhookSLACK_WEBHOOKSlack incoming webhook URL (required)
--slack-channelSLACK_CHANNELOverride the default channel
The Slack notification includes:
  • Pass/fail summary with test counts
  • Duration
  • Environment name
  • Failed test details (names, files, errors)

Teams Configuration

FlagEnv VarDescription
--teams-webhookTEAMS_WEBHOOKTeams incoming webhook URL (required)
The Teams notification uses Adaptive Cards and includes the same information as Slack notifications.

Multiple Services

Send to both Slack and Teams simultaneously:
hitspec run tests/ \
  --notify slack,teams \
  --slack-webhook "$SLACK_WEBHOOK" \
  --teams-webhook "$TEAMS_WEBHOOK"

CI/CD Example

# GitHub Actions
- name: Run API tests
  run: |
    hitspec run tests/ \
      --env staging \
      --output junit \
      --output-file results.xml \
      --notify slack \
      --notify-on failure
  env:
    SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
Store webhook URLs in environment variables or CI/CD secrets. Never commit them to your repository.