Comprehensive MCP tool integration tests and refactoring#3649
Open
souvikghosh04 wants to merge 7 commits into
Open
Comprehensive MCP tool integration tests and refactoring#3649souvikghosh04 wants to merge 7 commits into
souvikghosh04 wants to merge 7 commits into
Conversation
- Add McpToolTestBase with shared service provider builders and assertion helpers - Add ReadRecordsToolMsSqlIntegrationTests (filter, select, orderby, first, errors) - Add CreateRecordToolMsSqlIntegrationTests (valid data, missing fields, errors) - Add UpdateRecordToolMsSqlIntegrationTests (valid update, numeric fields, errors) - Add DeleteRecordToolMsSqlIntegrationTests (create-then-delete, verify-gone) - Add AggregateRecordsToolMsSqlIntegrationTests (count, sum/avg/min/max, groupby) - Refactor ExecuteEntityToolMsSqlIntegrationTests to use McpToolTestBase - Refactor DynamicCustomToolMsSqlIntegrationTests to use McpToolTestBase - Use DataTestMethod/DataRow to collapse similar test cases
16ed93d to
2f9745e
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a shared McpToolTestBase to centralize MCP tool test setup and introduces/expands MsSql integration test coverage for MCP built-in tools (read, create, update, delete, aggregate), while refactoring existing MCP integration tests to reduce duplication.
Changes:
- Added
McpToolTestBasewith reusable service-provider builders and common MCP response/assertion helpers. - Added new MsSql integration tests for
ReadRecordsTool,CreateRecordTool,UpdateRecordTool,DeleteRecordTool, andAggregateRecordsTool. - Refactored existing MsSql MCP integration tests to inherit from
McpToolTestBaseand reuse shared helpers.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Service.Tests/Mcp/McpToolTestBase.cs | New shared base class providing MCP tool execution helpers and DI setup for query/mutation tools. |
| src/Service.Tests/Mcp/ReadRecordsToolMsSqlIntegrationTests.cs | New integration tests for read_records covering select/filter/orderby/first and error cases. |
| src/Service.Tests/Mcp/CreateRecordToolMsSqlIntegrationTests.cs | New integration tests for create_record covering success and validation/error scenarios. |
| src/Service.Tests/Mcp/UpdateRecordToolMsSqlIntegrationTests.cs | New integration tests for update_record covering success and error scenarios. |
| src/Service.Tests/Mcp/DeleteRecordToolMsSqlIntegrationTests.cs | New integration tests for delete_record, including delete-then-read verification. |
| src/Service.Tests/Mcp/AggregateRecordsToolMsSqlIntegrationTests.cs | New integration tests for aggregate_records including scalar aggregates, group-by, pagination, and error paths. |
| src/Service.Tests/Mcp/ExecuteEntityToolMsSqlIntegrationTests.cs | Refactor to inherit from McpToolTestBase and reuse shared helpers/service provider. |
| src/Service.Tests/Mcp/DynamicCustomToolMsSqlIntegrationTests.cs | Refactor to inherit from McpToolTestBase and reuse shared helpers/service provider. |
…g, and aggregate response parsing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why make this change?
Add comprehensive integration test coverage for MCP built-in tools (ReadRecords, CreateRecord, UpdateRecord, DeleteRecord, AggregateRecords) and refactor existing tests to eliminate code duplication.
What is this change?
McpToolTestBaseshared base class with reusable service provider builders and assertion helpersExecuteEntityToolMsSqlIntegrationTestsandDynamicCustomToolMsSqlIntegrationTeststo inherit from base class[DataTestMethod]/[DataRow]to collapse similar test casesHow was this tested?
Sample Request(s)
N/A - test-only change.