Skip to content

Commit

Permalink
WIP docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechkral committed Feb 1, 2024
1 parent d4ed3e5 commit 2d0645b
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Data can be passed from fixture to tests using environment variables, in-memory
- [HTTP server](examples/http)
- [DB in a Docker container](examples/docker)

### Installation

```sh
cargo install -f cargo-fixture
```

### Getting started

The `cargo fixture` command is a drop-in replacement for the `cargo test` command with the difference that it starts a _fixture_ before running `cargo test`. The fixture continues running while `cargo test` runs, it is then told about test success and is given time to perform cleanup.
Expand Down Expand Up @@ -64,6 +70,22 @@ async fn some_test(client: TestClient) {

The `#[with_fixture]` macro marks the test `#[ignore]` outside of the `_fixture` feature, so that when you run plain old `cargo test`, the test that require fixture are simply skipped! This way, you can have a hefty fixture but still run unit tests using just `cargo test` very quickly.

### Multiple fixtures

Use `cargo fixture -F <name>` to use a fixture program different than the default (`fixture`).

### Troubleshooting fixtures

The `-x` flag lets you replace the `cargo test` command with a custom one. You can use this to run a shell instead of `cargo test`:

```sh
cargo fixture -x sh
```

This will ready the fixture and then enter a shell, in which you can inspect whether the fixture environment is prepared correctly, interact with it, or even run `cargo test` and interact with the environment post-tests.

### Platform support

FIXME: async runtimes, OSes
Async runtime: [Tokio](https://tokio.rs/), [smol](https://docs.rs/smol).

OS: Linux, Mac OS, Windows 10 or later.

0 comments on commit 2d0645b

Please sign in to comment.