| Project | Purpose |
|---|---|
| SharpClaw.Code.UnitTests | Fast tests (tools, permissions, serialization, MCP/plugin units, …) |
| SharpClaw.Code.IntegrationTests | Runtime + provider flows with real composition |
| SharpClaw.Code.MockProvider | DeterministicMockModelProvider, AddDeterministicMockModelProvider, ParityMetadataKeys, ParityProviderScenario |
| SharpClaw.Code.ParityHarness | End-to-end scenarios over real AddSharpClawRuntime + mock LLM |
| SharpClaw.Testing.* | JSON scenario contracts, oracle runner, CLI commands, and xUnit adapter for explicit agent testing |
Run all tests:
dotnet test SharpClawCode.slnRun the explicit agent scenario harness:
dotnet run --project src/SharpClaw.Code.Cli/SharpClaw.Code.Cli.csproj -- test run
dotnet run --project src/SharpClaw.Code.Cli/SharpClaw.Code.Cli.csproj -- test gatesBuild the example hosts as part of normal validation:
dotnet build examples/WebApiAgent/WebApiAgent.csproj
dotnet build examples/MinimalConsoleAgent/MinimalConsoleAgent.csproj
dotnet build examples/WorkerServiceHost/WorkerServiceHost.csproj
dotnet build examples/McpToolAgent/McpToolAgent.csprojFilter examples:
dotnet test SharpClawCode.sln --filter "FullyQualifiedName~ParityScenarioTests"
dotnet test SharpClawCode.sln --filter "FullyQualifiedName~ToolRegistry"DeterministicMockModelProvider implements IModelProvider with provider name mock.
Scenarios are selected via request Metadata key parityScenario (ParityMetadataKeys.Scenario):
streaming_text— deterministic deltas →"Hello world"stream_failure— throws (turn fails; session may becomeFailed)stream_slow— delays (cancellation / timeout scenarios)
AddDeterministicMockModelProvider registers the provider + PostConfigure<ProviderCatalogOptions> so default / deterministic aliases point at the mock.
ParityTestHost.Create (tests/SharpClaw.Code.ParityHarness/ParityTestHost.cs):
- Empty
IConfiguration AddSharpClawRuntime(configuration)AddDeterministicMockModelProvider()- Optional
ParityFixturePluginToolasISharpClawTool - Optional
ReplaceWithScriptedApprovals(bool)— swapsIApprovalServicefor deterministic approve/deny
ParityScenarioTests cover Provider/runtime, IToolExecutor (read/write/grep/bash), permissions, plugin echo tool, MCP registry partial startup, recovery after timeout.
Stable scenario ids are listed in ParityScenarioIds (e.g. streaming_text, read_file_roundtrip, write_file_allowed, write_file_denied, grep_chunk_assembly, bash_stdout_roundtrip, permission_prompt_approved, permission_prompt_denied, plugin_tool_roundtrip, mcp_partial_startup, recovery_after_timeout).
Note: Many scenarios exercise IToolExecutor directly rather than going through the LLM agent loop (which matches current AgentFrameworkBridge behavior).
The scenario harness lives in SharpClaw.Testing.Abstractions, SharpClaw.Testing.Harness, SharpClaw.Testing.Cli, and SharpClaw.Testing.Xunit. Scenario files live in tests/agent-scenarios and use JSON with explicit oracles. See docs/testing/agent-testing-harness.md for the contract, CLI usage, xUnit adapter, and gate model.
CI restores and builds the full solution, explicitly builds every example host project, runs dotnet test, then runs the explicit agent scenario harness through sharpclaw test run and sharpclaw test gates. Parity tests use temp directories under Path.GetTempPath() and avoid network.