|
| 1 | +<p align="center"> |
1 | 2 | <img src="logo.png" height="128" width="128" /> |
| 3 | +</p> |
2 | 4 |
|
3 | 5 | # Sprout: BDD Testing for F# |
4 | 6 |
|
| 7 | +> *Write your tests like your thoughts. Sprout is a lightweight F# test DSL with a clean, composable structure built on computation expressions.* |
| 8 | +
|
5 | 9 | [](https://github.com/dlidstrom/Sprout/actions/workflows/build.yml) |
6 | 10 |
|
7 | | -## Usage |
| 11 | +## ✅ Features |
| 12 | + |
| 13 | +* Minimalist & expressive BDD-style syntax |
| 14 | +* Nestable `describe` blocks |
| 15 | +* Computation expressions for `it`, `beforeEach`, `afterEach` |
| 16 | +* Pending tests supported by omission |
| 17 | +* Logging for improved tracing |
| 18 | +* Pluggable reporters (console, silent, TAP, JSON) |
| 19 | +* Built for F# — no extra syntax or matchers |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +### 🚀 Getting Started |
| 24 | + |
| 25 | +```bash |
| 26 | +dotnet add package Sprout |
| 27 | +``` |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +### 🧪 Example Test |
8 | 32 |
|
9 | 33 | ```fsharp |
10 | 34 | open Sprout |
@@ -73,3 +97,47 @@ let suite = describe "A test suite" { |
73 | 97 | Output: |
74 | 98 |
|
75 | 99 |  |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +### 🧩 Extending Sprout |
| 104 | + |
| 105 | +You can plug in your own reporter: |
| 106 | + |
| 107 | +```fsharp |
| 108 | +type MyCustomReporter() = |
| 109 | + interface ITestReporter with |
| 110 | + member _.BeginSuite(name, path) = ... |
| 111 | + member _.ReportResult(result, path) = ... |
| 112 | + member _.EndSuite(name, path) = ... |
| 113 | + member _.Info(message, path) = ... |
| 114 | + member _.Debug(message, path) = ... |
| 115 | + member _.End(testResults) = ... |
| 116 | +``` |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +### 🎯 Philosophy |
| 121 | + |
| 122 | +Sprout is built on: |
| 123 | + |
| 124 | +* **F# idioms** — computation expressions |
| 125 | +* **Extensibility** — pluggable reporters and hooks |
| 126 | + |
| 127 | +### Blocks |
| 128 | + |
| 129 | +| Name | Usage | Supported Expressions | |
| 130 | +|-|-|-| |
| 131 | +`describe` | Declarative | `it`, `beforeEach`, `afterEach`, `it`, `Info`, `Debug` | |
| 132 | +| `it` | Imperative | Any F# expressions, but typically exception-based assertions | |
| 133 | + |
| 134 | +--- |
| 135 | + |
| 136 | +### 📦 Package Info |
| 137 | + |
| 138 | +| | | |
| 139 | +| ------- | --------------------------- | |
| 140 | +| NuGet | `Sprout` | |
| 141 | +| Target | .NET Standard 2.0. | |
| 142 | +| License | MIT | |
| 143 | +| Author | Daniel Lidström | |
0 commit comments