Skip to main content

Module factory

Module factory 

Source
Expand description

Test factories (FactoryBot-style): build test records with unique sequences.

A type implements Factory::build to produce a default instance — usually using sequence for unique fields — and gets Factory::build_list for free. Pair with crate::testing::TestDb to persist them.

Traits§

Factory
Builds test instances of a type.

Functions§

sequence
A process-global, monotonically increasing counter for unique test values (FactoryBot sequence), e.g. format!("user{}@example.com", sequence()).