Configuring maximum number of tests has no effect in .NET Core
See original GitHub issueHere’s test pasted from https://fscheck.github.io/FsCheck/RunningTests.html
[Property]
public void Test()
{
var configuration = Configuration.Quick;
configuration.MaxNbOfTest = 1000;
configuration.QuietOnSuccess = true;
true.ToProperty().Check(configuration);
}
I’m changing the number assigned to MaxNbOfTest and the flag to true/false, but the test runner always displays Ok, passed 100 tests
.
The application is targeting .NET Core 2.0:
<TargetFramework>netcoreapp2.0</TargetFramework>
//..
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
<PackageReference Include="FsCheck" Version="2.10.6" />
<PackageReference Include="FsCheck.Xunit" Version="2.10.6" />
I was thinking runner itself has something to do with this, but both Resharper and Visual Studio Test Runner in my VS2017 provide same output.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Can't read app.config in C# .NET Core unit test project with ...
The console app reads the app.config fine, but the unit test method fails and I cannot figure out why. Both are using a...
Read more >Threading config settings - .NET
Learn about the settings that configure threading for .NET Core ... Specifies the maximum number of threads for the worker thread pool.
Read more >Configure unit tests by using a .runsettings file
This setting determines the maximum number of test DLLs, or other test containers that can run in parallel. Each DLL runs in its...
Read more >Unit Tests with Code Coverage No Longer Able to Run in ...
For the past few years, we've been running unit tests with code coverage in parallel using a custom local.testsettings file. With the release...
Read more >Boosting ASP NET Core application performance
In this article we will consider performance advice, which aims to boost entire application performance with maximum effect while minimizing ...
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
Like @ploeh said - that snippet is under the heading “Running a single property from an fsx/csx file or a command line runner”. What is happening is that you are running 100 times 1000 tests. The test method is interpreted as an Fscheck test with default config (there are properties on the
PropertyAttribute
to change these). Then, the inner test istrue.ToProperty().Check
which is executed 1000 times but doesn’t print anything on exit as per your config.See here for xUnit.net examples: https://fscheck.github.io/FsCheck/RunningTests.html#Using-FsCheck-Xunit
EDIT: I noticed there are no C# examples there, here’s one that’s trivial and equivalent to the stand-alone snippet:
In a unit test, you either need
QuickCheckThrowOnFailure
as described in https://fscheck.github.io/FsCheck/RunningTests.html, or, if you’re using FsCheck.XUnit, you must return theProperty
.