Skip to content

Allow randomizing 'Guid' test arguments with [Random] #3899

@julealgon

Description

@julealgon

[Random] currently supports several primitive types (mostly numeric ones), but it does not work with Guid. To provide different values to a Guid argument, one has to manually provide them either via [TestCaseSource] or via [ValueSource].

In my experience, being able to easily provide different Guid values to a test is fairly useful. Currently, I'm doing this by using a ValueSource, which caused a different problem, forcing me to resort to hardcoded Guids instead of using Guid.NewGuid.

I'm aware that Guid randomization is different than the standard one using the Random class, so I'm not sure if it would be possible to have the same "seed" in discovery and execution phases to build the unique test names with the built-in values (probably not).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions