Table of Contents

How to export counterexamples to files

When a property test fails and is shrunk, Conjecture can write the minimal counterexample to a file. This is useful for saving reproducers as CI artifacts, sharing failures with teammates, or feeding them to other tools.

Enable export

Set ExportReproOnFailure = true in settings:

[Property(ExportReproOnFailure = true)]
public bool My_property(int value) => value < 1000;

Or at the assembly level to export all failures:

[assembly: ConjectureSettings(ExportReproOnFailure = true)]

Configure the output path

By default, repros are written to .conjecture/repros/. Override with ReproOutputPath:

[Property(ExportReproOnFailure = true, ReproOutputPath = "artifacts/repros/")]
public bool My_property(int value) => value < 1000;

Or assembly-wide:

[assembly: ConjectureSettings(
    ExportReproOnFailure = true,
    ReproOutputPath = "artifacts/repros/")]

Output format

Each exported file is named after the fully qualified test method and the failure seed:

artifacts/repros/
  MyTests.My_property__seed_0xDEADBEEF.repro

The file contains the shrunk byte buffer that reproduces the failure. Conjecture can replay it via the [Property(Seed = ...)] attribute (see How to reproduce a failure).

CI artifact example

In a GitHub Actions workflow:

- name: Run tests
  run: dotnet test

- name: Upload repros
  if: failure()
  uses: actions/upload-artifact@v4
  with:
    name: conjecture-repros
    path: artifacts/repros/

See also