From 6a44c8feb15ed3ef880f7be6ba59164ca44bd068 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Mon, 5 Feb 2024 22:14:53 +0100 Subject: [PATCH] WIP --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index cce3c6f..924c152 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,18 @@ `cargo fixture` is a cargo extension that let's you surround `cargo test` with arbitrary Rust setup and teardown code. +In pseudo-code: + +```rust +cargo fixture [args...] { + fixture.rs { + // your setup code + let result = cargo test [args...] + // your cleanup code + } +} +``` + It can be used to run network servers that tests connect to, spin up docker containers, prepare test data, check for presence of programs,... or really anything that can be done from Rust code. Any provided resources can be released after `cargo test` finishes, whether manually, using RAII guards or closures. Data can be passed from fixture to tests using environment variables, in-memory K-V storage, or files. Additionally, the option to define serial tests is provided.