Questions related to usage of Expecto, the testing library. You can also ask related questions about its integrations with FsCheck, BenchmarkDotNet or Hopac here.
Expecto is a testing library for F#, written by Henrik Feldt:
- F# syntax throughout, tests as values; write plain F# to generate tests
- Use the built-in Expect module, or an external lib like Unquote for assertions
- Parallel tests by default
- Test your Hopac code or your Async code; Expecto is async throughout
- Pluggable logging and metrics via Logary Facade; easily write adapters for build systems, or use the timing mechanism for building an InfluxDB+Grafana dashboard of your tests' execution times
- Built in support for BenchmarkDotNet
- Build in support for FsCheck; makes it easy to build tests with generated/random data or building invariant-models of your object's/actor's state space
Hello world looks like this
open Expecto
let tests =
test "A simple test" {
let subject = "Hello World"
Expect.equal subject "Hello World" "The strings should equal"
}
[<EntryPoint>]
let main args =
runTestsWithArgs defaultConfig args tests