Skip to main content
Glama
README.mdโ€ข4.48 kB
# Kotlin MCP Server - Test Suite This directory contains the modular test suite for the Kotlin MCP Server project. ## ๐Ÿš€ Quick Start Run all tests: ```bash python3 -m pytest tests/ -v ``` Run tests with coverage: ```bash python3 -m pytest tests/ -v --cov=. --cov-report=html --cov-report=term ``` Run specific test modules: ```bash # Test only AI functionality python3 -m pytest tests/ai/ -v # Test only Gradle tools python3 -m pytest tests/tools/test_gradle_tools.py -v # Test only security utilities python3 -m pytest tests/utils/ -v ``` ## ๐Ÿ“ Test Structure ``` tests/ โ”œโ”€โ”€ conftest.py # Shared fixtures and configuration โ”œโ”€โ”€ test_server_core.py # Core server functionality โ”œโ”€โ”€ test_api_tools.py # External API integration โ”œโ”€โ”€ test_ui_layout_tools.py # UI/Layout components โ”œโ”€โ”€ ai/ โ”‚ โ””โ”€โ”€ test_llm_integration.py # AI/LLM features โ”œโ”€โ”€ generators/ โ”‚ โ””โ”€โ”€ test_kotlin_generator.py # Code generation โ”œโ”€โ”€ tools/ โ”‚ โ”œโ”€โ”€ test_gradle_tools.py # Gradle build system โ”‚ โ”œโ”€โ”€ test_project_analysis.py # Code analysis & quality โ”‚ โ””โ”€โ”€ test_build_optimization.py # Architecture setup โ””โ”€โ”€ utils/ โ””โ”€โ”€ test_security.py # Security utilities ``` ## ๐Ÿ“Š Coverage Information Current test coverage: **34.74%** ### Module Coverage: - **AI/LLM Integration**: 76.38% - **Security Utils**: 66.67% - **Core Server**: 41.50% - **Gradle Tools**: 38.10% - **Kotlin Generator**: 36.96% - **Project Analysis**: 31.58% - **Build Optimization**: 11.82% ## ๐Ÿงช Test Categories ### Core Functionality - Server initialization and configuration - Tool registration and routing - Error handling and edge cases ### Code Generation - Kotlin class/interface/data class creation - Android component generation (Activity, Fragment, Service, etc.) - UI component creation (layouts, views, drawables) ### Build & Project Management - Gradle tasks and dependency management - Project analysis and code quality tools - Architecture setup (MVVM, Room, Retrofit, etc.) ### AI Integration - AI-powered code generation - Code review and analysis - Refactoring suggestions - Documentation generation ### Security - Data encryption/decryption - Password hashing and verification - Secure storage configuration ## ๐Ÿ”ง Running Specific Tests ### By Module: ```bash # AI functionality pytest tests/ai/ -v # Kotlin generation pytest tests/generators/ -v # Build tools pytest tests/tools/ -v # Security utilities pytest tests/utils/ -v ``` ### By Test Name Pattern: ```bash # All tests containing "kotlin" pytest tests/ -k "kotlin" -v # All tests containing "security" pytest tests/ -k "security" -v # All tests containing "gradle" pytest tests/ -k "gradle" -v ``` ### With Coverage for Specific Modules: ```bash # Coverage for AI module only pytest tests/ai/ --cov=ai --cov-report=term # Coverage for tools only pytest tests/tools/ --cov=tools --cov-report=term ``` ## ๐Ÿ“ Adding New Tests 1. **Choose the appropriate directory** based on functionality 2. **Follow the naming convention**: `test_[module_name].py` 3. **Use the shared fixtures** from `conftest.py` 4. **Follow the test class pattern**: `TestModuleName` 5. **Add comprehensive test cases** including edge cases and error scenarios ### Example Test Structure: ```python import pytest from kotlin_mcp_server import KotlinMCPServer class TestNewModule: @pytest.fixture def server(self): server = KotlinMCPServer("test-server") server.set_project_path(tempfile.mkdtemp()) return server @pytest.mark.asyncio async def test_basic_functionality(self, server): result = await server.handle_call_tool("tool_name", {"arg": "value"}) assert "content" in result assert isinstance(result["content"], list) ``` ## ๐ŸŽฏ Next Steps 1. **Increase coverage** for build optimization and project analysis modules 2. **Add integration tests** for complex workflows 3. **Add performance benchmarks** for tool execution 4. **Mock external dependencies** to improve test isolation 5. **Add parameterized tests** for tool variations ## ๐Ÿ“š Documentation - See `TEST_REORGANIZATION_SUMMARY.md` for detailed reorganization information - Check individual test files for specific functionality coverage - Review `conftest.py` for available shared fixtures and utilities

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/normaltusker/kotlin-mcp-server'

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