-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Describe the problem this feature would solve
As a contributor, I would like to write tests based on properties that I want to hold and have test cases generated for those properties, so that I don't have to write numerous test cases, the generated test cases can be richer and my test code more clearly shows what properties it wants to test for.
Describe the solution
We make use of FsCheck to write property based tests. This should make it easier to write tests while running more test cases and it should help up find minimal cases of test failures quicker.
This will lets us write our test based on specifications and generate test cases. This will help up gain test coverage a lot more easily and allow us to replace some existing tests with ones that describe desired behavior more clearly.
We can start with new test on a control that lack tests and expand to others.
Additional context & Screenshots
Property bases testing originates from QuickCheck and FsCheck provides similar functionality. In FsCheck the user can write properties that they want to test and generators for test cases, then FsCheck will generate test cases for the properties being tested and if it finds a falling case it will attempt to simplify.
Some articles to show how this works and some motivation.
https://fscheck.github.io/FsCheck/
https://aaronstannard.com/fscheck-property-testing-csharp-part1/
https://simonreynolds.ie/fscheck-an-introduction/
https://youtu.be/_0BFkslU8yM
Computerphile video on QuickCheck