Skip to content

feat(tests): implement testing strategy for MCP tools #11

@CalvinAllen

Description

@CalvinAllen

Summary

Implement a comprehensive testing strategy for the 17 MCP tools exposed by the VS-VSMCP extension.

Current State

  • 17 MCP tools across 3 categories (Solution, Document, Build)
  • No existing test projects or test coverage
  • Three-tier architecture: MCP Client → Server Process (named pipes) → VS Extension

Proposed Test Projects

Project Purpose Framework
CodingWithCalvin.VSMCP.Server.Tests Unit tests for server tools xUnit
CodingWithCalvin.VSMCP.Shared.Tests Model and contract tests xUnit
CodingWithCalvin.VSMCP.Integration.Tests RPC pipe communication tests xUnit

Testing Layers

Unit Tests (High Priority)

  • Server Tools: Mock IVisualStudioRpc interface, verify tool methods handle parameters correctly and return expected results
  • Shared Models: JSON serialization/deserialization round-trips for all DTOs
  • Tool Discovery: Reflection-based tool enumeration from [McpServerTool] attributes

Integration Tests (Medium Priority)

  • RPC client/server named pipe communication (without VS)
  • Connection lifecycle (connect, disconnect, reconnect)
  • JSON-RPC message format validation
  • Error handling and timeout scenarios

E2E Tests (Manual)

  • Full flow with Visual Studio (requires experimental instance)
  • Claude Desktop integration testing

Tools to Cover

Solution Tools (5)

  • solution_info
  • solution_open
  • solution_close
  • project_list
  • project_info

Document Tools (11)

  • document_list
  • document_active
  • document_open
  • document_close
  • document_read
  • document_write
  • selection_get
  • selection_set
  • editor_insert
  • editor_replace
  • editor_find
  • editor_goto_line

Build Tools (5)

  • build_solution
  • build_project
  • clean_solution
  • build_cancel
  • build_status

Acceptance Criteria

  • Create test projects with xUnit framework
  • Implement unit tests for all 17 tools with mocked RPC
  • Implement model serialization tests
  • Implement RPC integration tests
  • Add test step to CI/CD workflow (.github/workflows/build.yml)
  • Achieve meaningful code coverage for server and shared projects

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions