Skip to content

Distributed trace-based test framework with fault injection

License

Notifications You must be signed in to change notification settings

kafka4beam/snabbkaffe

Repository files navigation

Snabbkaffe

If humans can find bugs by reading the logs, so can computers

Read the documentation for the latest version.

Snabbkaffe is a trace-based test framework for Erlang. It is lightweight and dependency-free.

It works like this:

  1. Programmer manually instruments the code with trace points
  2. Testcases are split in two parts:
    • Run stage where the program runs and emits event trace
    • Check stage where trace is collected and validated against the spec(s)
  3. Trace points become structured log messages in the release build

This approach can be used in a component test involving an ensemble of interacting processes. It has a few nice properties:

  • Checks can be separated from the program execution
  • Checks are independent from each other and fully composable
  • Trace contains complete history of the process execution, thus making certain types of concurrency bugs, like livelocks, easier to detect

Additionally, snabbkaffe supports fault and delay injection into the system to test correctness of the supervision trees and rare code paths.

Getting started

Add the following to rebar.config:

{deps, [{snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "1.0.0"}}}]}.