Make recorded test base class behavior configurable per server#1938
Open
Make recorded test base class behavior configurable per server#1938
Conversation
hallipr
commented
Mar 5, 2026
core/Microsoft.Mcp.Core/tests/Microsoft.Mcp.Tests/Client/Helpers/LiveTestSettingsBase.cs
Outdated
Show resolved
Hide resolved
hallipr
commented
Mar 5, 2026
core/Microsoft.Mcp.Core/tests/Microsoft.Mcp.Tests/Client/Helpers/LiveTestSettingsBase.cs
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull request overview
This PR generalizes the live/recorded test infrastructure to support multiple MCP server products (Azure, Fabric, Template) by making the test base classes generic over a settings type parameter. This is in partial support of issue #289 which aims to extract Azure-agnostic types from Azure.Mcp.Core into Microsoft.Mcp.Core.
Changes:
- Introduced
LiveTestSettingsBaseabstract class with server-agnostic settings andAzureLiveTestSettings,FabricLiveTestSettings,TemplateLiveTestSettingsas server-specific subclasses that each define their ownServerExecutableName. - Made
CommandTestsBase,RecordedCommandTestsBase, andLiveServerFixturegeneric overTSettings : LiveTestSettingsBase, and createdAzureRecordedTestsBaseto encapsulate Azure-specific sanitizer logic. - Migrated all ~40+ existing test files to use the new generic types and removed the old
LiveTestSettings,LiveTestSettingsFixture, andMcpTestUtilities.GetAzMcpExecutablePath().
Reviewed changes
Copilot reviewed 76 out of 76 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
core/Microsoft.Mcp.Core/tests/.../LiveTestSettingsBase.cs |
New abstract base class for server-agnostic test settings |
core/Microsoft.Mcp.Core/tests/.../LiveTestSettings.cs |
Deleted old non-generic settings class |
core/Microsoft.Mcp.Core/tests/.../LiveTestSettingsFixture.cs |
Deleted old fixture class (logic moved into LiveTestSettingsBase.LoadTestSettingsAsync) |
core/Microsoft.Mcp.Core/tests/.../CommandTestsBase.cs |
Made generic over TSettings, removed old PlaybackSettings and TryLoadLiveSettingsAsync |
core/Microsoft.Mcp.Core/tests/.../RecordedCommandTestsBase.cs |
Made generic over TSettings, moved default sanitizers to virtual PopulateDefaultSanitizers |
core/Microsoft.Mcp.Core/tests/.../LiveServerFixture.cs |
Made generic over TSettings, uses Settings.GetMcpExecutablePath() |
core/Microsoft.Mcp.Core/tests/.../McpTestUtilities.cs |
Removed GetAzMcpExecutablePath(), made params non-optional |
core/Azure.Mcp.Core/tests/.../AzureLiveTestSettings.cs |
New Azure-specific settings class |
core/Azure.Mcp.Core/tests/.../AzureRecordedTestsBase.cs |
New Azure-specific recorded test base with Azure sanitizers |
core/Fabric.Mcp.Core/tests/.../FabricLiveTestSettings.cs |
New Fabric-specific settings class |
core/Fabric.Mcp.Core/tests/.../Fabric.Mcp.Tests.csproj |
New test library project for Fabric |
core/Template.Mcp.Core/tests/.../TemplateLiveTestSettings.cs |
New Template-specific settings class |
core/Template.Mcp.Core/tests/.../Template.Mcp.Tests.csproj |
New test library project for Template |
Microsoft.Mcp.slnx |
Added Fabric and Template test projects |
servers/Fabric.Mcp.Server/Fabric.Mcp.Server.slnx |
Added Fabric test project |
servers/Template.Mcp.Server/Template.Mcp.Server.slnx |
Added Template test project |
servers/Azure.Mcp.Server/docs/new-command.md |
Updated assembly attribute namespace |
core/Microsoft.Mcp.Core/.gitignore |
Removed (moved to more specific location) |
core/Microsoft.Mcp.Core/tests/Microsoft.Mcp.Tests/.gitignore |
New gitignore for Generated directory |
| ~40 test files across tools/* | Mechanical migration to AzureRecordedTestsBase/CommandTestsBase<AzureLiveTestSettings> |
core/Microsoft.Mcp.Core/tests/Microsoft.Mcp.Tests/Client/Helpers/LiveTestSettingsBase.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.Monitor/tests/Azure.Mcp.Tools.Monitor.LiveTests/MonitorCommandTests.cs
Outdated
Show resolved
Hide resolved
core/Fabric.Mcp.Core/tests/Fabric.Mcp.Tests/FabricLiveTestSettings.cs
Outdated
Show resolved
Hide resolved
core/Template.Mcp.Core/tests/Template.Mcp.Tests/TemplateLiveTestSettings.cs
Outdated
Show resolved
Hide resolved
core/Microsoft.Mcp.Core/tests/Microsoft.Mcp.Tests/Client/Helpers/LiveTestSettingsBase.cs
Outdated
Show resolved
Hide resolved
core/Microsoft.Mcp.Core/tests/Microsoft.Mcp.Tests/Client/Helpers/LiveTestSettingsBase.cs
Outdated
Show resolved
Hide resolved
core/Microsoft.Mcp.Core/tests/Microsoft.Mcp.Tests/Client/Helpers/LiveTestSettingsBase.cs
Outdated
Show resolved
Hide resolved
hallipr
commented
Mar 5, 2026
core/Microsoft.Mcp.Core/tests/Microsoft.Mcp.Tests/Client/CommandTestsBase.cs
Show resolved
Hide resolved
scbedd
reviewed
Mar 5, 2026
core/Azure.Mcp.Core/tests/Azure.Mcp.Tests/Helpers/AzureLiveTestSettings.cs
Show resolved
Hide resolved
scbedd
approved these changes
Mar 5, 2026
Contributor
scbedd
left a comment
There was a problem hiding this comment.
1 nit. Check a livetest run of a couple sample ones manually before merge.
Member
Author
|
/azp run mcp - pullrequest - live |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…rs/LiveTestSettingsBase.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…stSettings.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…rs/LiveTestSettingsBase.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
What does this PR do?
Generalizes the live test infrastructure to support multiple servers:
AzureLiveTestSettingsandAzureRecordedTestsBaseto encapsulate Azure-specific test configuration and common test logic, enabling easier maintenance and extension for other products.LiveServerFixture<AzureLiveTestSettings>Fabric.Mcp.Tests) with its own live test settings class (FabricLiveTestSettings).McpTestUtilities.GetAzMcpExecutablePath(), replacing it with an override in each server-specific settings class.GitHub issue number?
Partially addresses #289
Pre-merge Checklist
servers/Azure.Mcp.Server/CHANGELOG.mdand/orservers/Fabric.Mcp.Server/CHANGELOG.mdfor product changes (features, bug fixes, UI/UX, updated dependencies)servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentationeng/scripts/Process-PackageReadMe.ps1. See Package README/servers/Azure.Mcp.Server/docs/azmcp-commands.mdand/or/docs/fabric-commands.md.\eng\scripts\Update-AzCommandsMetadata.ps1to update tool metadata in azmcp-commands.md (required for CI)ToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test promptsconsolidated-tools.json/servers/Azure.Mcp.Server/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test Pipeline