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:
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
Configuration Tests
MCP server configuration loading
LLM provider configuration
Environment variable overrides
Validation logic
Handler Tests
Tool handler interface compliance
Registry functionality
Error handling scenarios
Integration Tests
MCP Client Integration
Connection to stdio MCP servers
Connection to HTTP/SSE MCP servers
Tool discovery and invocation
Error handling and recovery
LLM Provider Integration
Provider factory registration
Registry initialization
Fallback mechanisms
Configuration parsing
Slack Integration
Socket Mode connection
Message handling
Formatting pipeline
Error responses
🧪 Running Tests
All Tests
Specific Components
Performance Tests
🔧 Manual Testing
MCP Server Testing
Test with Filesystem MCP Server
Test with Custom MCP Server
LLM Provider Testing
OpenAI Provider
Ollama Provider
Anthropic Provider
Slack Formatting Testing
Test Markdown Conversion
Test Block Kit Messages
Test Code Blocks
🏗️ Test Environment Setup
Local Development
Install Dependencies
Set Up Test MCP Servers
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:
Continuous Integration
Unit test execution
Code coverage reporting
Linting and formatting checks
Integration Testing
Docker container testing
Multi-platform builds
Dependency security scanning
📊 Test Data and Fixtures
Test Configurations
Test MCP Server Config (
test-fixtures/mcp-servers-test.json)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
Formatter
95%+
✅ 98%
Config
90%+
✅ 92%
MCP Client
85%+
✅ 87%
LLM Providers
85%+
✅ 89%
Slack Client
80%+
✅ 83%
Overall
85%+
✅ 88%
🚀 Test Best Practices
Write Tests First: Use TDD for new features
Test Edge Cases: Include error conditions and boundary values
Use Table Tests: For testing multiple input/output scenarios
Mock External Dependencies: Don't rely on external services in unit tests
Keep Tests Fast: Unit tests should complete in milliseconds
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?