gize-testing 0.7.0

Test utilities for Gize-generated applications.
Documentation

gize-testing

Test utilities for Gize-generated applications.

Crates.io License

gize-testing provides small, dependency-free helpers to exercise a Gize-generated app end to end, so the automated "compile, serve, call routes" loop is easy to run (including in CI).

  • EphemeralSqlite: a throwaway SQLite database (serverless, no database process needed), removed on drop. Ideal for CI runners.
  • App: spawns a compiled app binary against an EphemeralSqlite, waits until it accepts connections, and exposes base_url(). The child process is killed on drop.
  • free_port: pick a free TCP port.

Bring your own HTTP client for the assertions.

Usage

[dev-dependencies]
gize-testing = "0.7"
use gize_testing::{App, EphemeralSqlite};

let db = EphemeralSqlite::new();
// (apply migrations to db.url() first)
let app = App::spawn("target/debug/blog", &db)?;
// app.base_url() is now serving; make requests, assert, then drop to shut down.
# Ok::<(), std::io::Error>(())

Part of the Gize workspace

Crate Role
gize-core Domain model, manifest, dialect, conventions
gize-generator Codegen engine: safe writer, sync, plugins
gize-templates Templates for the generated code
gize-testing Test utilities for generated apps (this crate)
gize The gize CLI

License

Licensed under either of Apache-2.0 or MIT at your option.