Skip to content

[FEATURE] Generate Deterministic String Data #206

@AnthonyMBonafide

Description

@AnthonyMBonafide

Is your feature request related to a problem? Please describe.
When using this library, I provide a seed via the faker.NewWithSeedInt64(seed int64) function to get a Faker which I use to Fill a struct's fields with random data. However, the string data that is populated is different on each test run even if I provide the same seed.

Describe the solution you'd like
A struct with different field types have the same fake data provided if the same seed is provided to help reproducing failures easier.

Describe alternatives you've considered
I looked into using other functions which provide fake strings, like Person's Name as the string data since I do not really care about the contents. However, this does not work easily for my situation as I am creating a testing framework that uses generics and want to be able to pass any type to the faker library to create a fake data. With my alternative approach, I would have to use reflection to create the deterministic data myself.

Additional context
I am looking to create a test framework that can create test data for any type provided with an option of a seed to produce fake data across my whole application. I am using this to test various HTTP clients and potentially other parts of the system(i.e. various interfaces) and want the tests to be reproducible if a test fails for easy debugging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions