Header menu logo testify

Getting Started

This page is the shortest path from “I just opened Testify” to “I understand the model.”

[!WARNING] Testify and these docs are still under active development. Treat the examples here as the current intended direction, not as a claim that every surface is fully finished or thoroughly validated.

Build The Library

From the testify/ folder:

dotnet build .\src\Testify\Testify.fsproj --no-restore

That produces:

Build The Documentation Site

.\build-docs.ps1

That will:

For live preview:

.\watch-docs.ps1

watch-docs.ps1 keeps rebuilding and serving the site as files change, but it no longer auto-opens the docs in a browser.

Three-Minute Tour

1. Direct fail-fast assertion

open Testify
open Testify.AssertOperators

<@ 1 + 2 @> =? 3

This is the short, fail-fast path:

2. Inspect the result instead of throwing

When you want control instead of immediate failure, switch to result:

open Testify

let result =
    Assert.result
        (AssertExpectation.equalTo 3)
        <@ 1 + 2 @>

let rendered = Assert.toDisplayString result

This is the first big Testify design rule:

2.5. One Idea, Three Syntax Layers

The same assertion can be written in three equivalent ways:

Assert.should
    (AssertExpectation.equalTo 3)
    <@ 1 + 2 @>
<@ 1 + 2 @> |>? AssertExpectation.equalTo 3
<@ 1 + 2 @> =? 3

That is the core Testify DSL pattern:

3. Property check against a trusted reference

open Testify
open Testify.CheckOperators

<@ List.rev >> List.rev @> |=> id

This means:

If you want the structured result instead:

let result =
    Check.result(
        CheckExpectation.equalToReference,
        id,
        <@ List.rev >> List.rev @>)

4. One glimpse of the “teaching power”

Testify can do more than tell you that something failed. It can also attach configured or inferred hints.

Testify.configure (
    TestifyConfig.defaults
    |> TestifyConfig.withHintPacks BuiltInHintPacks.beginner
)

let result =
    Assert.result
        (AssertExpectation.equalTo "MiniLib")
        <@ "MiniLib " @>

let rendered = Assert.toDisplayString result

With hint packs enabled, the rendered output can point out likely causes such as whitespace-only mismatches instead of only showing raw expected/actual text.

Why Quotations?

The <@ ... @> syntax is what lets Testify keep the tested code visible in diagnostics.

Without quotations, a library usually sees only the final value or boolean result. With quotations, Testify can retain and render:

That is why Testify feels more explanatory than plain boolean asserts.

When To Choose result vs should

Use result when you want to:

Use should when you want to:

What To Learn Next

If you only learn four things first, make them these:

  1. Assert.should or =? for direct checks
  2. Check.should or |=> for reference-based property checks
  3. AssertExpectation.equalBy, equalByKey, and equalWith for domain semantics
  4. Check.result when you want rendering, replay, or collection instead of fail-fast behavior

Where To Go Next

Multiple items
module List from Microsoft.FSharp.Collections

--------------------
type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T with get member IsEmpty: bool with get member Item: index: int -> 'T with get ...
val rev: list: 'T list -> 'T list
val id: x: 'T -> 'T

Type something to start searching.