You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a domain where a lot of providers depend on some shared value, let's say it's the current timestamp.
Currently it's possible to have a fixed value and share this, but not test random different values.
In this example there are trivial ways to not need this (such as generating 1 list and partitioning), but this is an example of the base case where you have dependencies between providers.
Suggested Solution
It would be great if there was a way to have a random value from an Arbitrary, which is available and shared between multiple other @Providers.
One way I see that could be achieved is by allowing a @Domain to be initialized with a number of values from a Arbitrary.
This value can be random during normal runs, but should be fixed once a failure is detected and shrinking starts.
Discussion
There might already be a good way to do this, but I couldn't distill it from the documentation.
Lifecycle hooks seem related to this, but I don't think this use-case can be achieved with them.
The text was updated successfully, but these errors were encountered:
The standard solution for this problem is to provide related values in a single collecting object (self-made or some container like Tuple) and use flat mapping to derive generators from the common dependency. That sometimes requires some boilerplating, though.
Testing Problem
I have a domain where a lot of providers depend on some shared value, let's say it's the current timestamp.
Currently it's possible to have a fixed value and share this, but not test random different values.
In this example there are trivial ways to not need this (such as generating 1 list and partitioning), but this is an example of the base case where you have dependencies between providers.
Suggested Solution
It would be great if there was a way to have a random value from an
Arbitrary
, which is available and shared between multiple other@Provider
s.One way I see that could be achieved is by allowing a
@Domain
to be initialized with a number of values from aArbitrary
.This value can be random during normal runs, but should be fixed once a failure is detected and shrinking starts.
Discussion
There might already be a good way to do this, but I couldn't distill it from the documentation.
Lifecycle hooks seem related to this, but I don't think this use-case can be achieved with them.
The text was updated successfully, but these errors were encountered: