Service Virtualization for tests

VCR-style HTTP
record & replay

Like Ruby's VCR — record the HTTP your tests make, replay it offline — but the tape is readable Markdown you can share across languages and review in a Git diff.

One native engine · thirty languages · byte-identical tapes

get_person.md
## Interaction 0: GET /person/42

### Response body (200: application/json):
  {
-   "name": "Ada Lovelace"
+   "name": "Ada Lovelace",
+   "hairColor": "auburn"
  }
API drift shows up as an ordinary line-by-line diff in code review.

About

Service Virtualization for tests

Like Ruby's VCR, Servirtium records the HTTP conversations your tests make and replays them later without calling the real service — but the recording format is canonical, human-readable Markdown, so tapes can be shared across languages and API drift is reviewable in a Git diff.

For teams that love Agile, CI/CD, DevOps, or fast builds that devs can run on their workstations too. The name: SERvice VIRTualization IUM (inspired by Selenium).

Teams consuming vendor web-APIs

Eliminate the slow, flaky and costly parts of working against someone else's API in your test suite.

Vendors shipping example usages

Ship language-agnostic example scenarios — "out of credit at time of purchase", "increase an auction bid by a specified amount" — as Markdown tapes your clients can replay.

Why a web-service vendor would adopt this

Shipping Servirtium tapes is a developer-experience play. A vendor that hands clients ready-to-replay recordings lets those clients build and test against the API offline, for free, without sandbox keys or flaky network calls — so integrations land faster and churn less. Better DX wins evaluations and grows market share, which is exactly the incentive of a challenger trying to pull developers away from an incumbent.

Conversely, a vendor that is already dominant in its market has little reason to promote Servirtium: friction-free, portable integration makes it easier for customers to evaluate and switch to rivals. The vendors most likely to embrace shareable, Git-diffable tapes are the ones competing on openness and developer goodwill — not the ones relying on lock-in.

Servirtium VCR

One engine, many languages

servirtium-vcr is the current direction for Servirtium. Instead of a separate re-implementation per language, there is a single record/replay engine — Markdown parser/emitter, HTTP server, request matching, redaction, volatile-value handling and drift detection — written once in Aether, a language that compiles to C, and built as a native shared library with a plain C ABI. A thin FFI binding per language sits on top.

Because every language drives the same engine, cross-language compatibility is a build-time guarantee, not something each library re-derives and drifts on. Bindings carry no logic of their own. One monorepo, thirty languages (twenty-five native bindings plus Kotlin, Scala, Clojure, Groovy and F#, which ride on a sibling's), one build. The current release is 2.0.0-alpha.20.

Language Binding mechanism How you get it today In the monorepo
Go cgo Go module at the release tag, plus the native library from the release go/
Python ctypes pip install of the tag's python/ subdirectory, plus the native library (not the PyPI package of the same name, which is the old 1.x) python/
Java FFM / Panama (JDK 22+) fat jar from the release, installed into ~/.m2 as dev.servirtium:vcr (six natives inside) java/
.NET P/Invoke Servirtium.Vcr .nupkg from the release as a local NuGet feed (net8.0 and net48, natives inside) dotnet/
Rust libloading git dependency at the release tag, plus the native library rust/
Ruby Fiddle Bundler git source at the release tag, plus the native library ruby/
JavaScript & TypeScript koffi (Node 22+) npm tarball from the release (eight natives inside) javascript/
Dart (and Flutter) dart:ffi pub git dependency at the release tag, plus the native library dart/
PHP ext-ffi (PHP 8.2+) Composer path repository onto php/ of a checkout php/
Haskell foreign import ccall cabal source-repository-package, plus the native library haskell/
Elixir shares the Erlang NIF (BEAM) Mix, over the shared servirtium_nif app built from the release library elixir/
Pharo (Smalltalk) UnifiedFFI Metacello from the release tag, plus the native library pharo/
Nim importc (linked) the tag as source on --path, native library linked nim/
Zig extern C (linked) the package as source, native library linked zig/
Lua C extension (Lua 5.4) source plus a C extension compiled against the release library lua/
Erlang C NIF (canonical, shared) servirtium_nif and servirtium_erl built by erlang/build-nif-app.sh erlang/
Gleam shares the Erlang NIF (BEAM) path dependency, over the shared servirtium_nif app gleam/
LFE shares the Erlang NIF (BEAM) rebar3 project, over the shared servirtium_nif app lfe/
C the C ABI directly (header + link) servirtium.h and servirtium.c from the tag, native library linked c/
C++ header-only RAII wrapper over the C client servirtium.hpp plus the C client, native library linked cpp/
Crystal @[Link] + lib (linked) shards, from the repository at the release tag crystal/
D extern(C) (linked) dub, from the repository at the release tag d/
Julia ccall Pkg.add by URL at the release tag, plus the native library julia/
Janet built-in FFI (ffi/native) jpm install from the repository at the release tag janet/
Swift C interop via a module map SwiftPM from: 2.0.0-alpha.20 (the release's artifact bundle /
Swift 6.2+, macOS and Linux glibc) swift /

Each language has its own page with exact install steps, copyable record and playback snippets and a prompt for your coding agent: see all thirty languages. All of them build and test through one aeb run against the shared libservirtium_vcr. Each binding's README has a runnable "Getting it" recipe and quick-start; see the monorepo README.

JVM family. The Java binding's jar also serves Kotlin, Scala, Clojure and Groovy — thin idiomatic layers (a Kotlin trailing-lambda DSL, a Groovy Closure DSL, Scala helpers, Clojure fns + with-open) over the same jar, with no second native FFI.

CLR family. F# uses the same .NET package through ordinary .NET interop, with loan-pattern combinators on top. The BEAM languages (Erlang, Elixir, Gleam, LFE) share one NIF, so a runtime family only has to be bridged once.

Platforms and packages

Every release is cross-built from one Linux host and published on GitHub by Actions, with a .sha256 beside each file. Nothing is on a language registry yet (PyPI's servirtium is the old 1.x package), so the install routes are the release assets and tags below.

Native libraries

  • Linux x86_64 and arm64, glibc and musl
  • macOS x86_64 and arm64
  • Windows x86_64 and arm64 (no 32-bit engine)
  • FreeBSD x86_64

Named libservirtium_vcr-<tag>-<os>-<arch>[-musl].{so,dylib,dll}. Most bindings load the one for your machine through SERVIRTIUM_VCR_LIB; the bundled packages find it themselves.

Multi-platform packages on the release page

  • Java: servirtium-vcr-<ver>.jar, six natives inside (not musl or FreeBSD)
  • .NET: Servirtium.Vcr.<ver>.nupkg, eight runtimes inside, for net8.0 and .NET Framework 4.8
  • Node: servirtium-vcr-<ver>.tgz, eight natives inside
  • Swift: an artifact bundle of static libraries (macOS, Linux glibc) that the repository's Package.swift downloads for you

Any other language: get-package.sh

One script, one language name, and you get the artifact your tooling expects with the engine already inside it: a wheel, gem, npm tarball, NuGet feed, jar, a relocatable tarball with a pkg-config file, or a source package with the library staged in. It installs the pinned toolchain first and runs no tests.

curl -fsSL https://raw.githubusercontent.com/servirtium/servirtium-vcr/main/get-package.sh | sh -s -- ruby
# -> out/ruby/servirtium.gem, and the gem install line to run

Adding Servirtium to an existing project with a coding agent? Paste the ready-made prompt. Agents can also start from llms.txt.

Looking for the independent http4k implementation or the earlier standalone per-language libraries? See Other & earlier implementations.

Using it

Record once, commit, replay

Your system under test only needs one thing: the VCR's base URL. In record mode the VCR forwards to the real service and hands back the real response; in playback mode it answers from the tape with no network. The API is the same fluent builder in every language, in that language's own spelling.

Python — playback
import servirtium, urllib.request
 
with servirtium.playback("tapes/climate_api.md") \
        .redact_credentials().pretty_json() \
        .port(0).start() as vcr:
    body = urllib.request.urlopen(
        f"{vcr.base_url}/api/v1/countries").read()
    assert vcr.last_kind is servirtium.Outcome.OK
Python — record
with servirtium.record("tapes/climate_api.md",
        "https://climatedataapi.worldbank.org") \
        .redact_credentials().pretty_json() \
        .port(0).start() as vcr:
    urllib.request.urlopen(
        f"{vcr.base_url}/api/v1/countries").read()
    vcr.commit()   # only a commit writes the tape

A recording is written only by Commit(). Discard() drops it. Closing, disposing or dropping a record VCR with neither writes no tape and raises (Python's VcrError, .NET's and Java's VcrException, an error from Go's Close() and Rust's close(), and so on), so a test that fails part-way can no longer mint a tape that later replays as the truth. The scoped helpers in each language discard the recording when their block raises. Playback is unchanged: closing just stops it.

The same record call, elsewhere

Java
try (VcrServer vcr = Vcr.record(
        "tapes/climate_api.md", upstream)
        .redactCredentials().start()) {
    callTheService(vcr.baseUrl());
    vcr.commit();
}
C# (.NET 8 or Framework 4.8)
using var vcr = Vcr.Record(
        "tapes/climate_api.md", upstream)
    .RedactCredentials().Port(0).Start();
 
await CallTheService(vcr.BaseUrl);
vcr.Commit();   // Discard() on failure
Go
srv, err := servirtium.Record(
    "tapes/climate_api.md", upstream).
    RedactCredentials().Start()
if err != nil { t.Fatal(err) }
callTheService(srv.BaseURL())
if err := srv.Commit(); err != nil { t.Fatal(err) }
Rust
let rec = Vcr::record("tapes/climate_api.md", upstream)
    .redact_credentials().port(0).start().unwrap();
call_the_service(rec.base_url());
rec.commit().unwrap();   // or rec.discard()
JavaScript / TypeScript
const vcr = Vcr.record('tapes/climate_api.md', upstream)
  .redactCredentials().port(0).start()
try {
  await callTheService(vcr.baseUrl)
  vcr.commit()
} catch (e) { vcr.discard(); throw e }
Java — playback
try (VcrServer vcr = Vcr.playback(
        "tapes/climate_api.md")
        .redactCredentials().port(0).start()) {
    callTheService(vcr.baseUrl());
    assertEquals(Outcome.OK, vcr.lastKind());
}

Each binding's README and docs/usage.md in the monorepo have the exact spelling for its language.

What the engine does for you

One implementation behind every binding. The full list, with behaviour, defaults, examples and links to each feature's docs and tests, is the feature reference.

Credentials stay off the tape

RedactCredentials turns Authorization, cookies and API-key headers into numbered tokens (Bearer AUTHORIZATION_1, COOKIE_1) and matches them on presence in playback. RedactHeader, RedactQueryParam and RedactJsonField name what else to scrub, and named secret callbacks choose a token per request. The live test still sees the real bytes.

Volatile values

A rule such as request body: <a:MessageID>urn:uuid:{{messageId}}</a:MessageID> turns ids, timestamps and Date headers into tokens ({{messageId-1}}), so a re-record of an unchanged conversation is byte-identical. Playback matches any live value there and echoes it back where the token reappears. The rules ride in the tape's own ## Volatile values block.

The VCR's own address

{{baseUrl}}, {{request.host}} and {{request.scheme}} are filled from the live request, in responses and now in requests too, so a tape replays on any port. In record mode, RewriteUpstreamBase keeps a service that writes its own absolute URLs (TFS's location service, a HATEOAS API, a paging nextLink) from sending the client around the recorder.

Substitution and placeholders

Substitute rewrites a value in the replayed response (a marker of your own, such as a vault host, filled at playback; .NET's Placeholder does the request and response sides of one marker in a call), and Unredact restores a scrubbed request value before matching, so a committed tape still meets the test's real credential.

Readable bodies, stable order

PrettyJson(n) and PrettyXml(n) indent recorded bodies and canonicalize them for matching. Opt-in stable order sorts JSON keys, chosen arrays and response headers for services that answer in a different order each run, so a re-record is still byte-identical.

Matching and diagnostics

Strict method and path matching, opt-in header and body matching, order-independent MatchMultiple replay, and a playback range that replays a slice of a long tape. A mismatch report names the outcome, the closest candidate and the first real difference.

Drift detection

Fail-if-changed: a re-record writes the tape but flags any difference from the committed one, so CI catches an upstream change as a Git diff and a failing build — the TCK idea, built in.

Windows authentication: NTLM and Negotiate

Record mode pairs each client connection with an upstream connection of its own, so connection-bound authentication (NTLM, and Negotiate carrying NTLM, as with IIS, TFS, SharePoint and intranet WCF) records correctly. Pre-recorded NTLM tapes show what each leg of the handshake looks like and which rules make it replay.

.NET Framework 4.8

The one NuGet package serves .NET 8 and .NET Framework 4.8, including packages.config projects, and puts the right 64-bit engine (x64 or ARM64) in the output directory. A 32-bit build fails with a clear error, because there is no 32-bit engine. The package's tests run on Framework 4.8 too.

Tapes you can reuse

The repository's pre-recorded/ directory holds recordings of real services' HTTP APIs, for any language's tests (or for servirtium serve), each with its licence and terms noted:

  • · sixty-five containerised services (Vault, Elasticsearch, MinIO, CouchDB and more), recorded through testcontainers-ae;
  • · a Joomla 6 web-services API, and a Bruno collection of its examples converted to tapes;
  • · NTLM and Negotiate handshakes, with a README on what record and playback do with them.

Markdown format

The tape file, up close

This is the tape file your tests commit and diff. One readable Markdown document captures the whole HTTP conversation — request, response, headers, bodies — so a change to the API shows up as an ordinary line-by-line diff in code review.

Each payload sits in a Markdown code fence, so the XML or JSON appears verbatim — pretty-printed and unescaped. Compare that with stuffing an XML body into a JSON (or YAML) cassette, where it has to be escaped into a single unreadable string with \" and \n everywhere. A fenced block keeps the payload exactly as it went over the wire, which is what makes the diffs legible.

Here's some raw Servirtium markdown source — shown as inline SVG, so the text is real (selectable, searchable) and stays crisp at any zoom:

example1.md 1 ## Interaction 0: GET /path/to/resource 2 3 ### Request headers recorded for playback: 4 5 ``` 6 Header1: something 7 Header2: something else 8 ``` 9 10 ### Request body recorded for playback (application/xml): 11 12 ``` 13 <hello> 14   <how-are-you/> 15 </hello> 16 ``` 17 18 ### Response headers recorded for playback: 19 20 ``` 21 Content-Type: text/plain 22 Connection: keep-alive 23 Set-Cookie: CookieName=CookieValue 24 Header-X: abc-123 25 ``` 26 27 ### Response body recorded for playback (200: text/plain): 28 29 ``` 30 Mary had a little lamb 31 ```

(actual source file: github.com/servirtium/site/examples/example1.md)

Drop that same file in a repo and a code portal renders it beautifully — here's what GitHub makes of it. The rendered view is the default, and the exact bytes are always one click away via the Raw button (or ?plain=1):

Interaction 0: GET /path/to/resource Request headers recorded for playback: Header1: something Header2: something else Request body recorded for playback (application/xml): <hello>   <how-are-you/> </hello> Response headers recorded for playback: Content-Type: text/plain Connection: keep-alive Set-Cookie: CookieName=CookieValue Header-X: abc-123 Response body recorded for playback (200: text/plain): Mary had a little lamb

That's the whole point: one file that's human-inspectable in raw form and that your code portal renders in a pretty way too. You get the readable rendered view for review and the exact raw bytes for diffing — no trade-off between the two. If your code portal is GitHub, then 'pretty' is true.

(rendered on GitHub: github.com/servirtium/site/examples/example1.md)

... and you'd be storing that VCS as you would your automated tests.

Markdown Syntax Explained

Multiple Interactions Catered For

  • Each interaction is denoted via a Level 2 Markdown Heading. e.g. ## Interaction N: <METHOD> <PATH-FROM-ROOT>
  • N starts as 0, and goes up depending on how many interactions there were in the conversation.
  • <METHOD> is GET or POST (or any standard HTML or non standard method/verb name).
  • <PATH-FROM-ROOT> is the path without the domain & port. e.g. /card/addTo.doIt

Request And Reply Details Per Interaction

Each interaction has four sections denoted by a *Level 3 Markdown headers

  1. The request headers going from the client to the HTTP server, denoted with a heading like so ### Request headers recorded for playback:
  2. The request body going from the client to the HTTP server (if applicable - GET does not use this), denoted with a heading like so ### Request body recorded for playback (<MIME-TYPE>):. And <MIME-TYPE> is something like application/json
  3. The response headers coming back from the HTTP server to the client, denoted with a heading like so ### Response headers recorded for playback:
  4. The response body coming back from the HTTP server to the client (some HTTP methods do not use this), denoted with a heading like so ### Response body recorded for playback (<STATUS-CODE>: <MIME-TYPE>):

Within each of those there is a single Markdown code block (three back-ticks) with the details of each. The lines in that block may be reformatted depending on the settings of the recorder. If binary, then there is a Base64 sequence instead (admittedly not so pretty on the eye).

What else can be on a tape

Beyond the interactions, a tape written by servirtium-vcr can carry a few more sections, each opt-in. Playback tolerates all of them, and readers that predate them skip them.

  • ## LICENSE NOTICE — plain text at the top of the tape, before ## Interaction 0: the recorded service's licence terms. Playback ignores the text.
  • ## Volatile values — the rules that turn per-run values (ids, timestamps, Date headers) into tokens such as {{messageId-1}}, so a re-record of an unchanged conversation is byte-identical. The rules travel in the tape, so it replays with no rules in code.
  • ## [Note] <title>: — a note between interactions, written by the test for the human reading the tape.
  • ## [Recording rules] — a closing table of what the test asked the recorder to leave out or rewrite (removed headers, redactions), so a reader sees why a header is missing. The parser stops at this heading by design.
  • {{baseUrl}}, {{request.host}} and {{request.scheme}} — the VCR's own address, filled from the live request at playback, so a tape replays on any port. Credentials appear as numbered tokens such as Bearer AUTHORIZATION_1 when the recorder redacted them.
  • Bodies are byte-exact. A binary body is a Base64 block; JSON and XML bodies can be indented for reading (pretty_json, pretty_xml); gzip and chunked transfer are decoded to the stored payload.

The feature reference has the details, and tapes belong in version control without line-ending conversion (*.md -text in .gitattributes for the tape directory).

Recording and Playback

Recording a HTTP conversation

You'll write your test (say JUnit) and that will use a library (that your company may have written or be from a vendor). For recording you will swap the real service URL for one running a Servirtium middle-man server (which itself will delegate to the real service). If that service is flaky - keep re-running the test manually until the service is non-flaky, then commit the recording (Commit(); Discard() if the test failed — a recording that is neither committed nor discarded writes no tape and raises an error) and commit that Servirtium-style markdown to source-control. Best practice is to configure the same test to have two modes of operation: 'direct' and 'recording' modes. This is not a caching idea - it is deliberate - you are explicitly recording while running a test, or not recording while running a test (and doing direct to the service)

Anyway, the recording ends up in the markdown described in a text file on your file system - which you'll commit to VCS alongside your tests.

Playback of HTTP conversations

Those same markdown recordings are used in playback. Again an explicit mode - you're running in this mode and it will fail if there are no recordings in the dir/file in source control.

Playback itself will fail if the headers/body sent by the client to the real service (through the Servirtium library) are not the same they were when the recording was made. It is possible that masking/redacting (redact_credentials, structured redaction, volatile-value rules) and general manipulations should happen deliberately during the recording to get rid of transient aspects that are not helpful in playback situations. The test failing in this situation is deliberate - you're using this to guard against potential incompatibilities.

For example any dates in headers of the body that go from the client to the HTTP Server could be swapped for some date in the future like "2099-01-01" or a date in the past "1970-01-01".

The person who's designing the tests that recording or playback would work on the redactions/masking towards an "always passing" outcome, with no differences in the markdown regardless of the number of time the same test is re-recorded.

Note: How a difference in request-header or request-body expectation is logged in the test output needs to be part of the deliberate design of the tests themselves. This is easier said than done, and you can't catch assertion failures over HTTP.

Note2: this is a third mode of operation for the same test as in "Recording a HTTP conversation" above - "playback" mode meaning you have three modes of operation all in all.

Command line

Tapes without writing code

The monorepo also builds a standalone servirtium CLI — a single self-contained binary with the whole engine linked in. No language binding, no shared library, no runtime: a committed tape becomes a live stub server with one command, and tapes can be linted and converted from the shell or a CI step, including from HAR captures and Bruno collections.

shell
# replay a committed tape as a live stub server — zero code
servirtium serve tapes/checkout_flow.md 8080
curl http://127.0.0.1:8080/api/basket
 
# several tapes, comma-separated, served as one
servirtium serve tapes/basket.md,tapes/payment.md 8080
 
# lint every tape in a pre-commit hook or CI (exit 0/1)
servirtium check --canonical tapes/*.md
 
# capture in Chrome DevTools, convert once, replay forever
servirtium import capture.har tapes/from_browser.md
 
# turn a Bruno collection's saved examples into tapes (no network)
servirtium convert bru ./api-collection tapes/from-bruno
 
# or fire its requests at the real service and record the answers
servirtium import-bru ./api-collection https://api.example.test tapes/hydrated.md

serve <tape.md>[,more.md…] [port]

Replays a tape — or a comma-separated list, concatenated — as a live HTTP server. Point a frontend dev server at it, curl it, demo against it. By default replay is repeatable and order-independent (a stub-server-style lookup that never exhausts); --ordered switches to the strict test semantics — the recorded conversation, in order, each interaction consumed once.

check [--canonical] <tape.md> …

Lints tapes: exits 0 only if every file parses as valid Servirtium markdown — made for pre-commit hooks and CI gates. --canonical additionally requires the engine emitter's exact byte-form, so golden tapes stay diff-stable across re-records.

import / export (HAR bridge)

Converts an HTTP Archive capture — Chrome DevTools, Fiddler, Charles, mitmproxy, Postman — into a Servirtium tape, and back. Capture real traffic you can't easily proxy (a browser SPA, a mobile app), convert the .har once, then replay it deterministically under any binding or serve.

convert bru <collection> <out-dir> [--env NAME]

Converts the saved examples of a Bruno collection into tapes, with no network: one tape per request, one interaction per example, at a space-free path, with a CONVERSION.md listing what became what. Credentials are never written, and where an example documents no response body the note says so. .bru files are read by Bruno's own parser.

import-bru <collection> <upstream> <out.md>

Imports a Bruno collection and hydrates it: every request is fired through record mode at the real <upstream>, and the live responses become a replayable tape. It makes real calls (side effects on POST, PUT and DELETE), so point it at a service you mean to hit.

one static binary

The CLI statically links the same pure-Aether engine the thirty languages share — same parser, same matcher, same emitter — so what serve replays and what check accepts is exactly what your tests see. It is not a release download yet: build it from a checkout with aeb core/.cli.ae.

What it is

What is Servirtium?

Servirtium records HTTP conversations from your tests and replays them later without calling the real service. Unlike most VCR-style tools, the recording is canonical Markdown under source-control, so teams using different languages can share the same tapes. It aims to be a lingua franca for mock HTTP conversations:

  • ✓ libraries for many languages with interoperable record and playback capability;
  • ✓ agnostic about test-runner choices — use any unit test or spec framework;
  • ✓ "in process" for the testing tech in question (no process spawning);
  • ✓ web-API makers can ship Markdown conversations for known scenarios (with a sample test in their language);
  • ✓ tracking incompatibility with vendor or other-team web-APIs is easy (the key TCK concept).

How this differs from Ruby VCR

If you know VCR (or a Betamax-style port), you already know the workflow. Servirtium keeps the familiar record/replay loop and adds:

Familiar workflow

The same record-once, replay-forever loop you'd get from VCR.

Readable Markdown

Human-readable Markdown recordings, not YAML/JSON cassettes.

Language-neutral tapes

Record in one language, replay in another.

Git diffs as evidence

Tape diffs document API compatibility — or drift.

Shared core engine

One native engine driven by thin per-language bindings.

Cross-team negotiation

Record with a Ruby Test::Unit library, replay it from Java JUnit — useful when the publishing and consuming teams use different stacks.

In common with other Service Virtualization technologies

  • · tests can leverage previously recorded HTTP conversations;
  • · much faster than real services, which vary in speed and are typically slower than desired;
  • · don't fail in unexpected ways — real services can be flaky;
  • · don't require per-person credentials — real services often need API keys/tokens (even "sandbox" ones) that devs share against the rules;
  • · exclusively for test automation — production deployments hook up the real services.

Wikipedia maintains a Comparison of API simulation tools and a page on service virtualization; the comparison table lacks the columns needed to differentiate.

The Markdown difference

  • · Markdown renders well on GitHub and other code portals;
  • · an XML payload in a Markdown code fence still looks like XML — verbatim and unescaped;
  • · a JSON payload in a Markdown code fence still looks like JSON — verbatim and unescaped;
  • · compare that to embedding the same body inside a JSON or YAML cassette, where it gets escaped into one unreadable string — the fenced block keeps the payload (and its diffs) legible.

Technology Compatibility Kits

With Servirtium, the HTTP conversations invoked by running tests are recorded and replayed from the same Markdown format. Two teams could negotiate changes over time in those recordings. If that were a vendor and a client, the client could ask for (say) hair color in a /get-person/{id} web-API by sharing an example in Markdown — ideally in a Git repo, with a test/spec example of use. The vendor could likewise communicate forthcoming changes via Servirtium Markdown conversations in Git repos (private or public).

Related contract ideas / tools (prior art)

OpenAPI (formerly Swagger) and RAML are complementary to Servirtium, not competitive — they describe the shape of an API (its endpoints, parameters and schemas), while a Servirtium tape is a concrete, recorded instance of real traffic. OpenAPI says what can happen; a tape is a specific exchange that did happen, replayable offline and diffable in Git. The two pair naturally: use OpenAPI as the contract, and Servirtium tapes as the worked examples and regression guards for it. Servirtium does not read an OpenAPI document or check a tape against one itself; if you want that, export the tapes to HAR and use existing HAR and OpenAPI tooling — see Servirtium and OpenAPI.

TypeSpec (Microsoft's API-design language) sits one level up again: you author the API in TypeSpec and compile it down to OpenAPI, JSON Schema or protobuf as a build step. That's a design-time concern; Servirtium is a test-time one — and the two slot into the same pipeline. A CI build can emit the OpenAPI from TypeSpec and replay the Servirtium tapes for the relevant endpoints; if you also want recorded responses checked against the generated schema, export the tapes to HAR and feed them to a HAR-aware checker (see Servirtium and OpenAPI). A git diff of the tapes after a re-record already shows where real traffic stopped matching what you recorded before, which turns "the spec drifted from reality" into a failing build rather than a production surprise.

Postman or Postwoman remain tools you use to explore and learn web-APIs.

Ruby's VCR and its Betamax-style ports are the established record/playback service-virtualization tools — the closest prior art to Servirtium. They lack the canonical Markdown data model and the "git diff" TCK angle (see How this differs from Ruby VCR above), but could readily gain a mode that reads and writes Servirtium Markdown.

Mountebank has long offered an advanced way to programmatically mock web-APIs (and other wire protocols) and co-evolve them toward business deliverables; we hope it gains a "dumber" mode supporting our Markdown format. Similarly there's WireMock, Pact ("contract tests" since 2013), Netflix's Polly.js (2019), LinkedIn's Flashback (2017), Specto Lab's Hoverfly (2015), CA's Lisa (since 2014 — note it does not co-locate recordings with prod & test source), and Karate (Intuit's Peter Thomas). Contract testing is the same field as this, too.

Architectural paradigms

Service-Oriented Architecture (SOA) and Micro-Services are both better with Servirtium.

TCKs

TCKs — what's that about?

Technology Compatibility Kit is best known as a 2004 source set that Sun released to allow (subject to license) other implementation of Java. For Servirtium, a previously recorded set of HTTP interactions would be stored in source-control adjacent to the tests they correspond to and used in TWO broad ways:

Produced by OmniGraffle 7.12.1 2019-12-28 19:00:37 +0000 TCKs Layer 1 Build Infrastructure - Running Servirtium Automated Tests Developers* running tests on their workstations before committing/pushing functional changes to prod code (with tests obviously) Continuous Integration (CI) jobs running Servirtium tests in playback mode Jobs (non-CI / intermittent ) running Servirtium tests in record mode … with a deliberate job failure if different than before Continuous use of prior Servirtium test recordings (in playback mode) Push-triggered jobs running Servirtium tests for PR branches in playback mode Service tests that depend on Servirtium * and test engineers

Developers, test engineers and the CI-related automated jobs are running service tests in playback mode thousands or millions of times a day, and always pass quickly. If they fail that's something that can be fixed before commit/push and integration into trunk/master.

Because something could incompatible versus the "real" service an hourly or daily job is run in the same build infrastructure that runs the same tests in record mode. Those tests could fail, in which case the job fails an a developer investigates. If the service is flaky, this job can be run with retries=10 mode (whatever that is for the test framework) and may be coerced into passing. Sometimes this is needed because the vendor's infrastructure for "sandbox" is not as reliable as their production service. If the test suite passes, one last check is made on the Servirtium recordings (Servirtese?) before that build completes. That check is git diff and if there are any, then the job deliberately fails and a developer would be asked to investigate.

tck-diff-check.sh 1 # Your regular compile and invocation 2 # of pertinent service tests here: 3 4 your_compile.sh # job could fail here 5 your_test_suite_invocation.sh  # job could fail here, too 6 7 # passed, so far, but one more job failure opportunity based on 8 # differences in the recorded Servirtium Markdown (versus that committed) 9 10 theDiff=$(git diff --unified=0 path/to/module/src/test/mocks/) 11 if [[ -z "${theDiff}" ]] 12 then 13       echo " - No differences versus recorded interactions committed to Git, so that's good" 14 15 else 16       echo " - There SHOULD BE no differences versus last TCK 17       echo "   recording, but there were - see build log :-(  " 18       echo "**** DIFF ****:${theDiff}." 19       exit 1 20 fi

In servirtium-vcr you don't need the shell script for the record-mode job: fail-if-changed is a setting on the recorder. A re-record still writes the tape, but committing it raises an error if it differs from the one in Git, so the job fails and git diff shows the drift. Per-run noise (generated ids, timestamps) is handled by volatile-value rules, so only real changes count. See drift detection.

Oh and yes, a Markdown representation of one or more HTTP interactions is the easiest for seeing differences in a changed recording. That is because XML and JSON payloads sit in Markdown code fences, where they stay pretty-printed and verbatim. There's none of the escaping you'd get from cramming an XML body into a JSON (or YAML) cassette field — so the diffs read cleanly.

git diff diff --git a/src/mocks/averageRainfallForEgyptFrom1980to1999Exists.md b/src/mocks/averageRainfallForEgyptFrom1980to1999Exists.md index 7133dd2..5c714cc 100644 --- a/src/mocks/averageRainfallForEgyptFrom1980to1999Exists.md +++ b/src/mocks/averageRainfallForEgyptFrom1980to1999Exists.md @@ -21,6 +21,7 @@ Connection: keep-alive ``` Content-Type: application/xml +Connection: keep-alive Access-Control-Allow-Origin: * Access-Control-Allow-Headers: X-Requested-With Access-Control-Allow-Methods: GET

In this case World Bank's Climate API responded one day with an extra "Keep Alive" header. And the developer investigating decided it was probably OK to assume that it would be a regular feature of the API. XML or JSON payload differences can be multi-line of course. Committing the change (after a dev-workstation reproduction, means the same thing will not cause a TCK failure in the future.

History

Service Virtualization history

  1. Servirtium 2 - one engine, thirty languages

    2026

    The per-language libraries give way to servirtium-vcr: a single engine with a C ABI and thin bindings, byte-identical tapes, redaction, volatile values, a standalone CLI. Release 2.0.0-alpha.20 (November 2026) adds Commit()/Discard() for recordings, rewrite_upstream_base, NTLM-safe recording and .NET Framework 4.8 support

    servirtium-vcr

  2. Servirtium beta Released

    Autumn 2019

    Markdown record/playback syntax, a Java library, and examples: released. The key git-diff leveraging "TCK" (see below) aspect talked about too

    Servirtium-Java

  3. Service Virtualization the way it was

    2010 - 2019

    Centralized services (or a local daemon) that would record/playback (or manually stub/mock) HTTP services that stored recordings in JSON (or YAML) in source-control (or a centralized DB)

    Legacy SV technologies

  4. Before Service Virtualization

    1993 - 2010

    Your tests had to hit a shared 'integration' server's endpoints, where that always involved luck and some goodwill that the service was fast, online, consistent, and the version you wanted

    Before SV