Generate Tool Test
Create comprehensive table-driven tests for MCP tools with ease.
<!-- fake-claude-plugins/commands/generate-tool-test.md -->
description: Create comprehensive table-driven test for an MCP tool argument-hint: [tool-name]
@mcp-dev-go-sdk-agent Create a comprehensive test file at internal/tools/$1_test.go for the '$1' tool.
Test Coverage Required
Test Structure
- Table-driven test pattern
- Test fixtures and helpers
- Mock Twenty CRM API responses
Test Cases
- Happy Path: Successful operations with valid data
- Error Cases: API errors, network failures, timeouts
- Input Validation: Invalid inputs, missing required fields
- Edge Cases: Empty results, pagination, large datasets
- Context Cancellation: Verify graceful handling of cancelled contexts
Mocking
- Mock
client.TwentyClientinterface - Mock HTTP responses for each API call
- Use
httptest.Serverfor integration tests
Assertions
- Verify correct API calls made
- Check returned data structure
- Validate error handling
- Confirm context propagation
Include benchmark tests for performance validation.