Skip to main content
Glama
TESTING-GUIDE.mdβ€’6.79 kB
# Testing Guide This document explains how to run the various tests in this project and when to use each type. ## πŸ§ͺ Test Categories ### Unit Tests (Automated) ```bash npm test # Run all unit tests npm run test:watch # Run tests in watch mode npm run test:coverage # Run with coverage report ``` ### Integration Tests - Complete Suite ```bash npm run test:integration # Run ALL integration tests with Docker npm run test:integration:run # Run integration tests (requires running database) npm run test:integration:ci # For CI environments with external database ``` **Execution Order** (when running `npm run test:integration`): 1. Docker container setup and initialization 2. `npm run test:integration:manual` - Manual phase tests (1, 2, 3) 3. `npm run test:integration:protocol` - MCP protocol validation 4. `npm run test:integration:performance` - Performance validation 5. Docker container cleanup ### Integration Tests - Individual Categories #### ⚑ Performance Tests ```bash npm run test:integration:performance # ⭐ RECOMMENDED: Fast performance test (~2s) npm run test:integration:warp # Warp MCP integration test (~10s) ``` - **Primary Performance Test**: Single persistent MCP process, concurrent testing, 100% success rate - **Warp Integration Test**: Tests against running Warp instance, validates production setup - **Prerequisites for Warp test**: Warp must be running with MCP server configured #### πŸ”’ Security Tests (Manual Phases) ```bash npm run test:integration:manual # All manual phase tests (1, 2, 3) ``` - **Phase 1**: Validates read-only mode and basic security - **Phase 2**: Tests data manipulation (INSERT/UPDATE/DELETE) security - **Phase 3**: Tests schema modification (CREATE/DROP/ALTER) security #### πŸ“‘ Protocol Tests ```bash npm run test:integration:protocol # MCP protocol smoke test VERBOSE=1 npm run test:integration:protocol # Protocol test with detailed JSON output DEBUG=1 npm run test:integration:protocol # Protocol test with detailed JSON output ``` **Protocol Test Features**: - **Standard Mode**: Clean output showing only test results and status - **Verbose Mode**: Pretty-printed MCP initialize response for debugging - **JSON Response Analysis**: Detailed server capabilities, protocol version, and instructions ## πŸ“ Test File Organization ```text test/ β”œβ”€β”€ manual/ # Active manual tests β”‚ β”œβ”€β”€ improved-performance-test.js ⭐ Primary performance test β”‚ └── warp-mcp-performance-test.js # Warp integration test β”œβ”€β”€ integration/ # Integration tests β”‚ β”œβ”€β”€ manual/ # Manual security tests β”‚ β”‚ β”œβ”€β”€ phase1-readonly-security.test.js β”‚ β”‚ β”œβ”€β”€ phase2-dml-operations.test.js β”‚ β”‚ └── phase3-ddl-operations.test.js β”‚ β”œβ”€β”€ test-aws-secrets.js # AWS integration β”‚ β”œβ”€β”€ test-azure-secrets.js # Azure integration β”‚ β”œβ”€β”€ sqlserver-mcp-integration.test.js # Core MCP integration β”‚ └── error-scenarios-integration.test.js # Error handling tests β”œβ”€β”€ protocol/ # MCP protocol tests β”‚ └── mcp-server-startup-test.js # Protocol communication validation (supports VERBOSE=1) β”œβ”€β”€ docker/ # Docker testing infrastructure β”‚ β”œβ”€β”€ quick-stress-test.js # Docker stress testing β”‚ β”œβ”€β”€ test-connectivity.js # Connection validation β”‚ β”œβ”€β”€ verify-platform-detection.js # Platform detection β”‚ └── troubleshoot-apple-silicon.js # Apple Silicon troubleshooting β”œβ”€β”€ unit/ # Automated unit tests β”‚ └── *.test.js # Component unit tests β”œβ”€β”€ archived/ # Deprecated tests β”œβ”€β”€ temp/ # Temporary test artifacts β”œβ”€β”€ setup.js # Test environment setup β”œβ”€β”€ README.md # Testing documentation └── TEST_IMPROVEMENTS.md # Testing methodology improvements ``` ## 🎯 When to Use Each Test | Test Type | When to Use | Duration | Success Rate | | -------------------- | -------------------------------------------- | -------- | ------------ | | **Unit Tests** | Development, CI/CD | ~10s | ~100% | | **Performance Test** | Performance validation, regression testing | ~2s | 100% | | **Security Tests** | Security validation, compliance | ~30s | Varies | | **Warp Integration** | End-to-end validation with Warp | ~10s | ~100% | | **All Manual Tests** | Complete test suite (performance + security) | ~45s | Varies | ## πŸš€ Quick Start For most development and testing scenarios: ```bash # Run unit tests first npm test # Run performance validation npm run test:integration:performance # Run all integration tests if needed npm run test:integration ``` ## πŸ”§ Troubleshooting ### Common Issues 1. **SQL Server Connection Timeouts** - Check SQL Server is running and accessible - Verify `.env` configuration - Use the performance test to validate connectivity 2. **Test Process Hanging** - Kill any orphaned MCP processes: `pkill -f "node index.js"` - Check for port conflicts - Restart SQL Server if needed 3. **Performance Test Failures** - Use `npm run test:integration:performance` for reliable performance testing - Check connection pool settings and SQL Server accessibility ### Debug Commands ```bash # Check for running MCP processes ps aux | grep "node index.js" # Run protocol test with verbose JSON output VERBOSE=1 npm run test:integration:protocol # Run tests with clean output (suppressed ReDoS warnings) npm run test:unit # Automatically suppresses security warnings during testing # Test direct SQL connection (manual check) node -e " import sql from 'mssql'; import dotenv from 'dotenv'; dotenv.config(); sql.connect({ server: process.env.SQL_SERVER_HOST, database: process.env.SQL_SERVER_DATABASE, user: process.env.SQL_SERVER_USER, password: process.env.SQL_SERVER_PASSWORD, options: { encrypt: true, trustServerCertificate: true } }).then(() => console.log('βœ… SQL Server connection OK')).catch(console.error); " ``` ## πŸ“ˆ Performance Benchmarks Expected performance for the improved performance test: - **Startup time**: < 5 seconds - **Query response**: 50-500ms - **Concurrent queries**: 10 queries in ~250ms - **Memory usage**: < 100MB - **Success rate**: 100% If your results significantly differ from these benchmarks, there may be an environmental or configuration issue.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/egarcia74/warp-sql-server-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server