Skip to content

Introduction ​

VLatte is a mocking framework for Go. In a test, mockhttp and mockgrpc start real HTTP and gRPC servers that answer the way the test says: match a request on its method, path, headers, query or body, reply with a status, headers and a templated body, call a webhook, or forward what nothing matches to a real upstream.

The vlatte CLI serves HTTP and gRPC mocks from YAML or JSON files, records what passes through it and plays it back, and takes new mocks over an admin API.

Two ways to use it ​

In Go testsWith the vlatte CLI
Startsmockhttp.MustNew() or mockgrpc.MustNew() in the testvlatte, a binary or a Docker image
MocksBuilt in Go, or loaded from mock filesMock files, and the admin API
FitsUnit and integration tests of Go codeAny language, local development, demos, CI environments

Both share one engine: everything a mock file says, Go can say too, and the other way round for what a file can hold.

Where to go next ​

  • Install the library and the CLI.
  • Write a first test in the quick start.
  • Learn the few ideas everything else builds on in Concepts.
  • See where a server's settings come from: code, a .vlatterc file, VLATTE_* variables and flags.
  • Then read the section of your protocol, HTTP or gRPC, and then the sections of the features both share, such as Matchers, Templating and Scenarios.