Skip to main content

Fixture

Trait Fixture 

Source
pub trait Fixture: Sized + 'static {
    type Setup: Default;

    // Required methods
    fn start(setup: Self::Setup) -> impl Future<Output = Result<Self>>;
    fn url(&self) -> String;
    fn quit(self) -> impl Future<Output = Result<()>>;

    // Provided methods
    fn config() -> Config { ... }
    fn init_tracing() { ... }
}
Expand description

The application under test, started afresh for every test and taken down after it.

A suite names one fixture in harness!, and every test is handed the one started for it beside the browser, so whatever a test needs to reach behind the page (a database, a port, a channel into the server) is its own.

Required Associated Types§

Source

type Setup: Default

What one test asks of the fixture started for it. harness! sets a bool field of this for every word in the parentheses after a test’s name; () where no test asks for anything.

Required Methods§

Source

fn start(setup: Self::Setup) -> impl Future<Output = Result<Self>>

Start the application for one test.

Source

fn url(&self) -> String

Where the browser is pointed for this test.

Source

fn quit(self) -> impl Future<Output = Result<()>>

Take the application down once its test has finished.

Provided Methods§

Source

fn config() -> Config

How this suite is run: its name, its frontend and its lock.

Source

fn init_tracing()

Install the run’s tracing subscriber. The default prints INFO and above.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§