-
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
Support asynchronous computations: Async and Task #428
Comments
Thank you for creating this issue. In case Twitter stops working, here's the full contents of the tweet:
(Links automatically created by the copy-paste action from Twitter.) FWIW, Task-based properties are possible in FsCheck 3 (which is in perpetual beta) - just in case someone wants some inspiration. |
Why do you want a |
Everything that's asynchronous in .NET is |
What makes you say that? Async still has benefits (implicit cancellation token passing and tail recursion), and Async programming in F# says explicity to prefer Async:
|
@cmeeren, fair enough, To be clear, I wouldn't mind if Hedgehog supports testing against When I need to test something asynchronous, it's always because I'm working with some kind of .NET API, and they're always As soon as I change detail level to write smaller tests (unit tests), I know how to design code so that it's not asynchronous at all. Thus, I don't need this feature for unit testing; I need it for integration testing, and therefore I need it for |
Thanks for the clarification. I find it interesting that you use Hedgehog (property-driven, lots of test repetitions) for integration tests. I'd be interested in reading an article on that at some point! |
I don't, because I can't (because I can't write asynch properties). I use FsCheck instead.
Keep an eye on this article series 😉 |
A relevant excerpt from the fsharp-hedgehog-xunit docs:
[<Property>]
let ``Async with exception shrinks`` (i: int) = async {
do! Async.Sleep 100
if i > 10 then
failwith "whoops!"
}
=== Output ===
Hedgehog.FailedException: *** Failed! Falsifiable (after 12 tests):
(11) Grepping FsCheck for |
Requested by @ploeh in this tweet.
The text was updated successfully, but these errors were encountered: