running-tests
Skill2.7k starsChanged 10 months agoMITView on GitHub
Guide for running tests in the openai-dotnet repository. Use this when asked to run, debug, or validate tests, or when writing new tests. Explains test modes (Playback, Record, Live), how to identify recorded vs non-recorded tests, environment variable configuration, and what to do when recordings are missing or stale.
3 other projects use a version of this.
Trending
Quiet since September.about the whole repository
Most recently taken up by
- ZaxbyHub/opencode-swarmtheir own version, first seen Sep 5, 2026
- codeverbojan/claude-code-kickstarttheir own version, first seen Apr 8, 2026
- straub/agent-skillstheir own version, first seen Feb 4, 2026
Who's talking about openai/openai-dotnet
- OkGoDoIt/OpenAI-API-dotnet“Big announcement: official support from Microsoft!”GitHub · May 10, 2024 · 5 reactions
- PowerShell/AIShell“Support displaying the Chain-of-Thought tokens for DeepSeek R1”GitHub · Apr 18, 2025 · 4 reactions
- OpenRouterTeam/openrouter-examples“OpenRouter compatible with SemanticKernel”GitHub · Jan 7, 2025 · 4 reactions
- A Hacker News story“OpenAI now has an official .NET library”Hacker News · Jun 7, 2024 · 3 points
- modelcontextprotocol/csharp-sdk“Content types that represent binary data are exposing UTF16 encoded strings”GitHub · Dec 5, 2025 · 2 reactions
The biggest 5 of 19 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 19
Talked about on GitHub and Hacker News (19 times).
On GitHub · 18
- May 10, 2024Big announcement: official support from Microsoft! — OkGoDoIt/OpenAI-API-dotnet5 reactions · 12 comments
- Apr 18, 2025Support displaying the Chain-of-Thought tokens for DeepSeek R1 — PowerShell/AIShell4 reactions
- Jan 7, 2025OpenRouter compatible with SemanticKernel — OpenRouterTeam/openrouter-examples4 reactions · 5 comments
- Dec 5, 2025Content types that represent binary data are exposing UTF16 encoded strings — modelcontextprotocol/csharp-sdk2 reactions · 3 comments
- Sep 25, 2025[BUG] Latest Azure.AI.OpenAI is incompatible with latest OpenAI — Azure/azure-sdk-for-net2 reactions · 6 comments
13 more on GitHub
- Sep 23, 2025[BUG] AzureFileClient.UploadFileAsync: Method not found: 'Void OpenAI.Files.OpenAIFile..ctor — Azure/azure-sdk-for-net2 reactions · 1 comment
- Aug 24, 2025feat: appsettings modeling OpenAI gpt — aliencube/open-chat-playground2 reactions · 8 comments
- Sep 2, 2026[C#] Generated JsonPatch propagation throws for nullable nested dynamic model properties — microsoft/typespec1 reaction
- Sep 2, 2026[http-client-csharp] ApiCompat can add null guards to nullable reference properties — microsoft/typespec1 reaction
- Jun 17, 2026[Responses] Add ResponsesClientOptions in OpenAI.Responses — review-bench/openai_openai-dotnet1 reaction · 1 comment
- Jun 16, 2026[Azure.AI.Projects] Responses input transform strips reasoning item 'id', breaking stateless encrypted-reasoning replay (HTTP 400 invalid_payload) — Azure/azure-sdk-for-net1 reaction · 4 comments
- May 22, 2026.NET: [Feature]: .NET Support for oauth_consent_request via AGUI — microsoft/agent-framework1 reaction · 3 comments
- Dec 23, 2025.NET AI ResponseItem Conversion Repro Example — dotnet/extensions1 reaction · 1 comment
- Nov 7, 2025Add [JsonIgnore] to JsonPatch property to avoid limitation in System.Text.Json — microsoft/typespec1 reaction
- Aug 5, 2025[BUG] 404 when using the latest Azure.OpenAI (2.2.0-beta5) + Latest OpenAI (2.3.0) — Azure/azure-sdk-for-net1 reaction · 2 comments
- May 4, 2025.Net: Bug: OpenAI Assistant throws Invalid URI: The Uri string is too long. — microsoft/semantic-kernel1 reaction · 3 comments
- Oct 29, 2024[Azure.AI.OpenAI] Add net8.0 target / remove RequiredTargetFrameworks workaround — Azure/azure-sdk-for-net1 reaction · 2 comments
- Jun 10, 2024[BUG] OpenAI Legacy Completion endpoint not exposed — Azure/azure-sdk-for-net1 reaction · 6 comments
On Hacker News · 1
- Jun 7, 2024OpenAI now has an official .NET library3 points
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- ZaxbyHub/opencode-swarm★ 485same name
- codeverbojan/claude-code-kickstart★ 2same name
- straub/agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository2 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- ingesting-specSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 5 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
Do not run Record or Live mode yourself.
- Distinctive: line 32
Before running tests, always set:
- Distinctive: line 39
If a recorded test needs new recordings or updated recordings, you must follow the instructions below to ask a human to capture them for …
- Distinctive: line 43
Treat these as practical indicators instead of a rigid checklist.
- Distinctive: line 68
When asking for recordings, always provide:
- Distinctive: line 97
If you need one exact fixture instance, use:
- Very specific: line 109
If multiple tests need recording, combine them in a single NUnit.Where expression:
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Running Tests
Overview
Tests in this repository use the Microsoft.ClientModel.TestFramework and NUnit.
Many tests rely on session recordings — pre-recorded HTTP interactions stored in tests/SessionRecords/ — so they can run without live service access. The repository defaults to Playback mode unless overridden in the environment.
Test Modes
| Mode | Description |
| Playback | Tests run against pre-recorded session data in tests/SessionRecords/. No API key is required. |
| Record | Tests run against the live OpenAI API and produce or update session recordings. Requires an API key. |
| Live | Tests run against the live OpenAI API without producing or updating session recordings. Requires an API key. |
The mode is controlled by the CLIENTMODEL_TEST_MODE environment variable and accepts Playback, Record, or Live.
In Playback mode, the framework may attempt to auto-record when a session recording is missing or stale. Disable that behavior by explicitly setting CLIENTMODEL_DISABLE_AUTO_RECORDING to true.
Agent Rules
As the agent, only execute tests in Playback mode.
Do not run Record or Live mode yourself. Those paths require live credentials which you do not have.
Before running tests, always set:
$env:CLIENTMODEL_TEST_MODE = "Playback"
$env:CLIENTMODEL_DISABLE_AUTO_RECORDING = "true"If a recorded test needs new recordings or updated recordings, you must follow the instructions below to ask a human to capture them for you instead of trying to capture them yourself.
Identifying Recorded Tests vs Non-Recorded Tests
Treat these as practical indicators instead of a rigid checklist.
Strong signals that a test is a recorded test:
- The test class inherits from
OpenAIRecordedTestBase. - The test method uses
[RecordedTest]. - The test gets clients through
GetProxiedOpenAIClient. - The test exercises real service behavior rather than mocked responses.
Strong signals that a test is not a recorded test:
- The test class inherits from something other than
OpenAIRecordedTestBaseor has no base class. - The test method uses plain
[Test]instead of[RecordedTest]. - The test uses mocked transports or handcrafted responses to simulate HTTP responses, such as
MockPipelineTransport,MockPipelineResponse, orGetClientOptionsWithMockResponse. - The test does not need to reach a live cloud service.
When Recordings Are Missing or Stale
Recordings must be captured by a human.
Request recordings from a human before considering your work complete in either of the following cases:
- You added a new recorded test (which implies its recording is missing because it has never been recorded before).
- An existing recorded test fails in Playback mode because its recording is missing or stale (for example, if the recorded test was modified and the existing recording no longer matches).
When asking for recordings, always provide:
- The link to the recording workflow
- The exact
NUnit.Whereexpression - A copy-pasteable
dotnet testcommand
You must use this template:
Please record tests using the recording workflow: https://github.com/openai/openai-dotnet/actions/workflows/record-test.yml
Use the following
NUnit.Whereexpression:test == 'Namespace.TestClass.TestMethodName'Alternatively, run the following command locally and push the recordings manually:
dotnet test ./tests/OpenAI.Tests.csproj --configuration Release --framework "net10.0" -- NUnit.Where="test == 'Namespace.TestClass.TestMethodName'"
Use NUnit.Where for recording requests even when dotnet test --filter would work locally. NUnit.Where is the contract used by the recording workflow. Prefer test == ... because it matches the exact discovered NUnit test name and avoids ambiguity. For NUnit fixture-parameterized tests such as classes constructed with bool isAsync, the discovered test names may include fixture arguments like (True) or (False).
For a single ordinary test, use:
test == 'Namespace.TestClass.TestMethodName'If you need one exact fixture instance, use:
test == 'Namespace.TestClass(True).TestMethodName'Example for async fixture instance of the GenerateSingleEmbedding recorded test:
test == 'OpenAI.Tests.Embeddings.EmbeddingsTests(True).GenerateSingleEmbedding'If multiple tests need recording, combine them in a single NUnit.Where expression:
(test == 'Namespace.TestClass.TestA') or (test == 'Namespace.TestClass.TestB')Example for both fixture instances of the GenerateSingleEmbedding recorded test:
(test == 'OpenAI.Tests.Embeddings.EmbeddingsTests(True).GenerateSingleEmbedding') or (test == 'OpenAI.Tests.Embeddings.EmbeddingsTests(False).GenerateSingleEmbedding')Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

