Skip to content

[Testing] Introduce the fake crate for helping to create faked data instead of repeating boilerplate initializations in tests #4446

@cylewitruk

Description

@cylewitruk

There are a number of situations where the need for initializing complex types with "faked", but still valid, exists -- primarily in the context of tests. Currently, most tests are using boilerplate code for this, or some tests simply just don't exist likely due to the complexity of creating these objects by hand.

The fake crate makes this a breeze, providing a number of out-of-the-box generators but also allowing full customization of how types, or even specific fields of a type (for example Strings), are generated. The idea here is that this should help to remove a lot of the mental "hinders" from writing good tests involving complex objects.

This ticket is a placeholder for introducing the crate into projects and defining generators for the most commonly used types.

You can see an example of the crate in-use in my PR here.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Status: ✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions