QUICK_START.md•3.56 kB
# Quick Start - Testing Guide
Fast reference for running Multilead MCP server tests.
## Setup (One-Time)
```bash
# Navigate to project
cd /home/gotime2022/Projects/mcp-servers/multilead-mcp
# Activate global virtual environment
source /home/gotime2022/.claude/venv/bin/activate
# Install dependencies
pip install -e ".[dev]"
```
## Run Tests
### Basic Commands
```bash
# Run all tests
pytest
# Verbose output
pytest -v
# Very verbose (show more details)
pytest -vv
# Show print statements
pytest -s
# Stop after first failure
pytest -x
```
### Run Specific Tests
```bash
# Single file
pytest tests/test_tools.py
pytest tests/test_resources.py
pytest tests/test_prompts.py
# Single test
pytest tests/test_tools.py::test_create_lead_success
# Pattern matching
pytest -k "lead" # All tests with "lead"
pytest -k "error" # All error tests
pytest -k "create or get" # Tests with "create" OR "get"
```
### Coverage Reports
```bash
# Terminal report
pytest --cov=. --cov-report=term
# HTML report
pytest --cov=. --cov-report=html
# Then open: htmlcov/index.html
# Both
pytest --cov=. --cov-report=html --cov-report=term
```
### Parallel Execution
```bash
# Install xdist
pip install pytest-xdist
# Run with 4 workers
pytest -n 4
```
## Test Statistics
- **Total Tests**: 82
- **Test Files**: 3 (test_tools.py, test_resources.py, test_prompts.py)
- **Tools Tested**: 77/77 (100%)
- **Resources Tested**: 2/2 (100%)
- **Prompts Tested**: 2/2 (100%)
## Common Issues
### Issue: Module not found
```bash
# Solution: Install package
pip install -e .
```
### Issue: pytest not found
```bash
# Solution: Activate venv and install
source /home/gotime2022/.claude/venv/bin/activate
pip install pytest pytest-asyncio
```
### Issue: Tests fail due to server middleware
```bash
# Note: Tests mock the HTTP layer
# Server middleware issue won't affect tests
# Tests will work even with middleware bug
```
## Test Categories
### By Component
- **Tools** (48 tests): All 77 tools with success/error cases
- **Resources** (17 tests): Config and stats resources
- **Prompts** (17 tests): Lead enrichment and campaign analysis
### By Scenario
- **Success Cases** (44 tests): Valid inputs and expected outputs
- **Error Handling** (8 tests): 401, 404, 429, 500, timeout
- **Validation** (16 tests): Format, metadata, content checks
- **Parametrized** (4 tests): Multiple input combinations
## Quick Reference
| Command | Purpose |
|---------|---------|
| `pytest` | Run all tests |
| `pytest -v` | Verbose output |
| `pytest -k "keyword"` | Filter by keyword |
| `pytest --cov` | Coverage report |
| `pytest -x` | Stop on first failure |
| `pytest tests/test_tools.py` | Run single file |
| `pytest --collect-only` | List tests without running |
| `pytest -m asyncio` | Run only async tests |
## File Locations
```
multilead-mcp/
├── tests/
│ ├── conftest.py # Fixtures
│ ├── test_tools.py # 48 tests
│ ├── test_resources.py # 17 tests
│ ├── test_prompts.py # 17 tests
│ ├── pytest.ini # Configuration
│ ├── QUICK_START.md # This file
│ └── TEST_SUMMARY.md # Detailed summary
└── TESTING.md # Full documentation
```
## Need Help?
1. Check **TESTING.md** for comprehensive guide
2. Check **TEST_SUMMARY.md** for test breakdown
3. Check **conftest.py** for available fixtures
4. Check **FastMCP docs**: https://gofastmcp.com/patterns/testing
---
**Last Updated**: 2025-11-05