<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/testing-beyond-your-imagination-property-based-testing-in-c-with-fscheck-vzdwcd36c" -->

---
title: Testing beyond your imagination: Property-based testing...
description: A tutorial introducing property-based testing in C# using FsCheck and NUnit, contrasting it with example-based testing through a Scrabble score calculator and...
canonical: https://daily.dev/posts/testing-beyond-your-imagination-property-based-testing-in-c-with-fscheck-vzdwcd36c
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Testing beyond your imagination: Property-based testing in C# with FsCheck | daily.dev
og:description: A tutorial introducing property-based testing in C# using FsCheck and NUnit, contrasting it with example-based testing through a Scrabble score calculator and...
og:url: https://daily.dev/posts/testing-beyond-your-imagination-property-based-testing-in-c-with-fscheck-vzdwcd36c
og:image: https://api.daily.dev/og/posts/VzDwCD36C.png
og:image:alt: Testing beyond your imagination: Property-based testing in C# with FsCheck
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing beyond your imagination: Property-based testing in C# with FsCheck

**[Code4IT](https://daily.dev/sources/code4it)** · 17 min read · 0 upvotes · 0 comments

## Summary

A tutorial introducing property-based testing in C# using FsCheck and NUnit, contrasting it with example-based testing through a Scrabble score calculator and a card deck example. It covers writing properties with the [Property] attribute, configuring MaxTest and Parallelism, building custom generators (Arbitraries) and shrinkers, using Prop.ForAll with traditional NUnit assertions, and guidance on when to prefer property-based versus example-based testing.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.code4it.dev/blog/property-based-testing-fscheck>

## Questions this post answers

### How do I write a property-based test in C# using FsCheck with NUnit?

Install the FsCheck.NUnit NuGet package, then write a test method decorated with [FsCheck.NUnit.Property] that takes generated parameters and returns a bool representing the invariant to check. FsCheck generates 100 random inputs by default and runs the test against each, reporting the exact failing value if the property is false for any input.

_daily.dev surfaces practical guides like this for developers building out property-based test suites._

### How many test cases does FsCheck run by default and how do I change it?

FsCheck runs 100 checks by default for each property test, with 4 checks executed in parallel. These can be adjusted using the MaxTest and Parallelism parameters on the FsCheck.NUnit.Property attribute, for example Property(MaxTest = 1000, Parallelism = 8), though increasing MaxTest significantly also increases test suite run time.

_developers tuning test suite performance can track testing framework defaults like these on daily.dev._

### What is shrinking in property-based testing and how does FsCheck support custom shrinkers?

Shrinking is the process where, after finding a failing random input, FsCheck automatically searches for the smallest input that still reproduces the failure, making debugging easier. For custom types, a shrinker function can be supplied alongside a custom Arbitrary via Arb.From(gen, shrinkFunction), returning progressively smaller candidate values such as strictly decreasing numeric fields.

_daily.dev helps developers dig into advanced testing techniques like custom shrinkers when debugging flaky edge cases._

## Similar posts on daily.dev

- [Best Practice for Property-Based Testing](https://daily.dev/posts/best-practice-for-property-based-testing-xhzceorv3) · Software Testing Magazine · 0 upvotes · 0 comments
- [What is a property?](https://daily.dev/posts/what-is-a-property--ngbye7wme) · Hacker News · 0 upvotes · 0 comments
- [Does your code match your spec?](https://daily.dev/posts/does-your-code-match-your-spec--beehfvwqo) · Kiro · 0 upvotes · 0 comments

---

Tags: [#testing](https://daily.dev/tags/testing), [#c#](https://daily.dev/tags/c#)

[View this post on daily.dev](https://daily.dev/posts/testing-beyond-your-imagination-property-based-testing-in-c-with-fscheck-vzdwcd36c)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Testing beyond your imagination: Property-based testing in C# with FsCheck","url":"https://daily.dev/posts/testing-beyond-your-imagination-property-based-testing-in-c-with-fscheck-vzdwcd36c","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/testing-beyond-your-imagination-property-based-testing-in-c-with-fscheck-vzdwcd36c"},"datePublished":"2026-10-04T13:06:59.816Z","dateModified":"2026-10-04T13:14:52.220Z","description":"A tutorial introducing property-based testing in C# using FsCheck and NUnit, contrasting it with example-based testing through a Scrabble score calculator and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6fe0085710d0a5f1fdf8c000b53bd3f7?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6fe0085710d0a5f1fdf8c000b53bd3f7?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Code4IT","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Code4IT","logo":"https://media.daily.dev/image/upload/s--OaaG4G10--/f_auto,q_auto/v1791119049/logos/code4it?_a=BAMAMicg0","url":"https://daily.dev/sources/code4it"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/testing-beyond-your-imagination-property-based-testing-in-c-with-fscheck-vzdwcd36c","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"testing,c#","timeRequired":"PT17M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Code4IT","item":"https://daily.dev/sources/code4it"},{"@type":"ListItem","position":3,"name":"Testing beyond your imagination: Property-based testing in C# with FsCheck"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/testing-beyond-your-imagination-property-based-testing-in-c-with-fscheck-vzdwcd36c#faq","mainEntity":[{"@type":"Question","name":"How do I write a property-based test in C# using FsCheck with NUnit?","acceptedAnswer":{"@type":"Answer","text":"Install the FsCheck.NUnit NuGet package, then write a test method decorated with [FsCheck.NUnit.Property] that takes generated parameters and returns a bool representing the invariant to check. FsCheck generates 100 random inputs by default and runs the test against each, reporting the exact failing value if the property is false for any input. daily.dev surfaces practical guides like this for developers building out property-based test suites."}},{"@type":"Question","name":"How many test cases does FsCheck run by default and how do I change it?","acceptedAnswer":{"@type":"Answer","text":"FsCheck runs 100 checks by default for each property test, with 4 checks executed in parallel. These can be adjusted using the MaxTest and Parallelism parameters on the FsCheck.NUnit.Property attribute, for example Property(MaxTest = 1000, Parallelism = 8), though increasing MaxTest significantly also increases test suite run time. developers tuning test suite performance can track testing framework defaults like these on daily.dev."}},{"@type":"Question","name":"What is shrinking in property-based testing and how does FsCheck support custom shrinkers?","acceptedAnswer":{"@type":"Answer","text":"Shrinking is the process where, after finding a failing random input, FsCheck automatically searches for the smallest input that still reproduces the failure, making debugging easier. For custom types, a shrinker function can be supplied alongside a custom Arbitrary via Arb.From(gen, shrinkFunction), returning progressively smaller candidate values such as strictly decreasing numeric fields. daily.dev helps developers dig into advanced testing techniques like custom shrinkers when debugging flaky edge cases."}}]}
```

