FsCheck.Xunit doesn't support C# async tests
See original GitHub issueWith a test like:
[Property]
public async Task TestWhatever(int i)
{
Assert.True(await DoSomething(i));
}
The Xunit runner fails with:
System.Exception:
No instances of class FsCheck.Testable+Testable`1[a] for type System.Threading.Tasks.Task
Issue Analytics
- State:
- Created 8 years ago
- Comments:31 (22 by maintainers)
Top Results From Across the Web
xUnit Async Test Not Working Properly
The problem is that async void method does not return a Task object which xUnit could possibly examine for exceptions.
Read more >List of unit testing frameworks
Code-driven unit testing frameworks for various programming languages are as follows. Some, but not all, are based on xUnit. ... Fixtures: Indicates whether...
Read more >Running tests - FsCheck
An FsCheck test fails from xUnit.NET's perspective if it finds a counter-example, or if the arguments are exhausted. It passes when FsCheck can...
Read more >What I wish I knew when learning F#
As described above, Async's are not evaluated until run whereas Tasks in most uses are immediately started (just like Promises and Futures in ......
Read more >A restaurant example of refactoring from example-based to ...
A restaurant example of refactoring from example-based to property-based testing by Mark Seemann. A C# example with xUnit.net and FsCheck.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think it’s fine to use it - I’ve been considering getting 3.0 out pretty much as is, and moving all the long term stuff to a subsequent version.
This is now in pre-release in NuGet in 3.0-alpha1: https://www.nuget.org/packages/FsCheck/3.0.0-alpha1
Please try it out and open new issues in case of problems.