Testing Guide: Slack MCP Client

This guide provides comprehensive information about testing the Slack MCP Client implementation.

✅ Current Test Coverage

Unit Tests

The project includes comprehensive unit tests for core components:

  1. Formatter Tests (internal/slack/formatter/formatter_test.go)

    • Message format detection

    • Markdown to Slack mrkdwn conversion

    • Block Kit JSON parsing and validation

    • Quoted string conversion

    • Field truncation handling

  2. Configuration Tests

    • MCP server configuration loading

    • LLM provider configuration

    • Environment variable overrides

    • Validation logic

  3. Handler Tests

    • Tool handler interface compliance

    • Registry functionality

    • Error handling scenarios

Integration Tests

  1. MCP Client Integration

    • Connection to stdio MCP servers

    • Connection to HTTP/SSE MCP servers

    • Tool discovery and invocation

    • Error handling and recovery

  2. LLM Provider Integration

    • Provider factory registration

    • Registry initialization

    • Fallback mechanisms

    • Configuration parsing

  3. Slack Integration

    • Socket Mode connection

    • Message handling

    • Formatting pipeline

    • Error responses

🧪 Running Tests

All Tests

Specific Components

Performance Tests

🔧 Manual Testing

MCP Server Testing

  1. Test with Filesystem MCP Server

  2. Test with Custom MCP Server

LLM Provider Testing

  1. OpenAI Provider

  2. Ollama Provider

  3. Anthropic Provider

Slack Formatting Testing

  1. Test Markdown Conversion

  2. Test Block Kit Messages

  3. Test Code Blocks

🏗️ Test Environment Setup

Local Development

  1. Install Dependencies

  2. Set Up Test MCP Servers

  3. Configure Test Slack App

    • Create a test Slack workspace

    • Set up a bot with required permissions

    • Use test tokens for development

CI/CD Testing

The project includes GitHub Actions workflows for:

  1. Continuous Integration

    • Unit test execution

    • Code coverage reporting

    • Linting and formatting checks

  2. Integration Testing

    • Docker container testing

    • Multi-platform builds

    • Dependency security scanning

📊 Test Data and Fixtures

Test Configurations

  1. Test MCP Server Config (test-fixtures/mcp-servers-test.json)

  2. Test LLM Config (test-fixtures/config-test.yml)

Mock Objects

The test suite includes mock implementations for:

  • Mock MCP Server: Simulates MCP server responses

  • Mock LLM Provider: Returns predictable responses for testing

  • Mock Slack Client: Captures sent messages for verification

🐛 Debugging Tests

Verbose Test Output

Test Debugging

📈 Coverage Targets

Component
Target Coverage
Current Status

Formatter

95%+

✅ 98%

Config

90%+

✅ 92%

MCP Client

85%+

✅ 87%

LLM Providers

85%+

✅ 89%

Slack Client

80%+

✅ 83%

Overall

85%+

✅ 88%

🚀 Test Best Practices

  1. Write Tests First: Use TDD for new features

  2. Test Edge Cases: Include error conditions and boundary values

  3. Use Table Tests: For testing multiple input/output scenarios

  4. Mock External Dependencies: Don't rely on external services in unit tests

  5. Keep Tests Fast: Unit tests should complete in milliseconds

  6. Test Real Scenarios: Integration tests should use realistic data

📋 Test Checklist

Before deploying:

This comprehensive testing approach ensures the Slack MCP Client is reliable, maintainable, and ready for production use.

Last updated

Was this helpful?