Testing the .NET SDK
Run dotnet test for the conformance suites that replay the Python reference's recorded behaviour and the drift guard; run the live suites with ALERTOPS_LIVE=1 only against a test tenant.
Overview
Relevant for Developers maintaining or extending the SDK
The .NET SDK isn't trusted on its own word. The Python reference SDK is verified live against a real tenant and exports conformance vectors: the exact request it sends for every op, its core decisions, and recorded traces of every helper and semantic flow. The xUnit suites replay all of them and must match exactly. Live suites then check transport, auth and TLS against the tenant.
Run the suites
Relevant for Developers before every commit
dotnet build -warnaserror
dotnet test
ALERTOPS_LIVE=1 ALERTOPS_DOTENV=path/to/.env dotnet test --filter Live
| Suite | Test | What it proves |
| Requests | ConformanceTests.EveryOpSendsTheSameRequestAsPython | All 2,036 request vectors (802 public ops and 30 internal executor ops) send Python's exact method, URL, query, auth header and body. |
| Core | ConformanceTests (errors, statuses, retries, query, pagination, envelopes, dotenv) | Error parsing, status → error class, retry decisions, every paginator's page sequence, envelopes and .env parsing. |
| Flows | ConformanceTests.EveryHelperReplaysItsPythonTraces | All 247 helper traces: the same requests in the same order, then the same result or error. |
| Functions | FunctionAndDriftTests.PureFunctionsMatchPython | 109 pure helpers and the Python semantics they rely on (str(), json.dumps, quote, title case …). |
| Semantic | SemanticTests | 58 planner vectors and 35 executor traces, with the clock frozen. |
| Drift | FunctionAndDriftTests (lock, generated code, ids, flows, stubs) | The generated code, the vendored spec and its lock hash agree, every flow has an implementation, and nothing is a stub. |
| Live | LiveSmokeTests, LiveSemanticTests | Real tenant: auth, error mapping, pagination, ingest-to-close, blueprint apply, verify and rollback. |
The live tests are skipped unless ALERTOPS_LIVE=1 is set. Each run appends every HTTP exchange as JSONL {"id", "status"} to artifacts/live-events/<suite>.jsonl.
Update after a reference change
Relevant for Developers syncing with the Python reference
- In alertops-python, run python tools/export_spec.py (it re-derives sdk-spec/ from the Python SDK).
- Run python tools/sync_spec.py (it copies the bundle into every language repo).
- Run python tools/codegen/run.py cs (it regenerates src/AlertOps.Sdk/Generated/ and docs/REFERENCE.md).
- Run dotnet test. A failing vector means the .NET core or a helper no longer matches Python. Fix it until the suite is green.
Never edit src/AlertOps.Sdk/Generated/
Those files are produced from the spec and carry a DO NOT EDIT header with the spec hash. The drift test fails if they are edited or stale.
Live testing rules
Relevant for Anyone running the live suites
- Run them only against a test tenant.
- Every object is named sdktest-net…, users are @example.com, and everything is deleted in reverse order, even when a step fails.
- Leftovers can be listed and removed with alertops-python's python tools/sweep.py --prefix sdktest-net.
Cross-language replay
Relevant for Anyone checking .NET against the Python live run
The replay runner repeats calls the Python live suite recorded, with Python's exact arguments, through the generated .NET methods. It checks that each call gets the status Python got.
ALERTOPS_REPLAY_FILE=<dir>/replay.json ALERTOPS_DOTENV=path/to/.env dotnet run --project tools/AlertOps.Replay
It writes <dir>/dotnet-results.json and exits non-zero on any mismatch.
Troubleshooting
Relevant for Anyone whose suite fails
VendoredSpecMatchesItsLock fails
- The sdk-spec/ copy was edited or has CRLF line endings. Re-run sync_spec.py. The repo pins LF in .gitattributes.
A flow vector fails with "made more requests than Python"
- The .NET helper calls an extra endpoint, or misses an early return. Compare it line by line with the Python flow named in the vector.
Related Articles
- Getting Started with the AlertOps .NET SDK
- Calling the API from .NET
- Helpers and the Semantic Layer in .NET
Need help?
Email support@alertops.com or contact your AlertOps representative.