-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xUnit integration #144
Comments
In order for this to work, you'll need the Then, this hypothetical |
That could be done using the attribute: [<Property(Gens={Gen.defaults with Char = Gen.alphaNum})>] |
Are you sure this will actually compile? |
Well that's a good question, I didn't think of that. No, I don't think that will compile. |
Closing this as I can't see an easy way of overriding the defaults in the hypothetical |
When auto-generation (#133) is implemented (e.g. in
Hedgehog.Experimental
as discussed in #139), it might be nice to offer a simple kind of xUnit integration (similar to FsCheck) that can be used for simple purposes (for example in a new assemblyHedgehog.Xunit
that depends onHedgehog.Experimental
). It might turn out to be counterproductive, but I'm opening an issue anyway so it can be discussed. Here's what I'm talking about:A simple test using the current API, where all values can be auto-generated:
The same simple test in a proposed new API (note the new attribute):
One could customize the run using the attribute, e.g.
[<Property(Tests=500)>]
.Open questions:
Will this push developers away from best practices? I can imagine the simpler syntax being used in cases where the full
property { }
syntax would be a better choice.Are there actually that many usecases where one can rely exclusively on auto-generated values? I have currently only used Hedgehog in a single (real-life) project, but in that specific example, that's definitely not the case - I require more control.
The need for more control over the generation could be alleviated somewhat (not fully) by filtering. But how should this be done? Without a
property
expression, thewhere
clause isn't available. (FsCheck has its own operator for this,<boolExpression> ==> [lazy] <restOfTest>
.)What happens when not all values can be auto-generated? One could force the user to use the normal API, or we could have a slightly simplified combined API like this:
All of the above points considered, I'm not convinced this is a good idea, but it has its use cases.
The text was updated successfully, but these errors were encountered: