The v3 release comes with new bells and whistles – it now supports async tests and has out-of-the box integration with Ionide's test location support. When you write a test in Ionide you can now use Expecto out of the box to run them and run them on code changes! After running them you'll get highlights in the editor to show which failed and which passed. Thanks to @Krzysztof-Cieslak for his contributions!
Asserting on floats with
There's also a new
Expect.floatClose assertion function that's more robust than
floatEquals. We've updated the docs for you, and there's this pull request with the background. Thanks @AnthonyLloyd for your contributions!
Async test support
When you run performance tests or use
Expect.fasterThan, remember to use the newly added
testSequenced function that can tag Test-values (testList, testCase, testCaseAsync) to make your tests robust to run in parallel.
- This release provides a runTestsWithArgs function which runs the passed tests and also overrides the passed ExpectoConfig with the command line parameters.
- Expecto now accepts the command line argument --fail-on-focused-tests, which checks if focused tests exist. This parameter can be set in build scripts and allows CI servers to reject commits that accidentally included focused tests.
If someone has focused a test but not unfocused it before committing, you can now have the CI server go red! ;)
I'm happy to release another minor version of Expecto with a new performance-test feature – namely
Don't let the name mislead you. It's actually a more profound test that builds on Student's T-test by using Welch's T-test for validating the hypothesis that the two passed functions are equally fast. Here's a sample:
testSequenced (testCase "matrix" <| fun _ -> let n = 100 let rand = Random 123 let a = Array2D.init n n (fun _ _ -> rand.NextDouble()) let b = Array2D.init n n (fun _ _ -> rand.NextDouble()) let c = Array2D.zeroCreate n n let reset() = for i = 0 to n-1 do for j = 0 to n-1 do c.[i,j] <- 0.0 let mulIJK() = for i = 0 to n-1 do for j = 0 to n-1 do for k = 0 to n-1 do c.[i,k] <- c.[i,k] + a.[i,j] * b.[j,k] let mulIKJ() = for i = 0 to n-1 do for k = 0 to n-1 do let mutable t = 0.0 for j = 0 to n-1 do t <- t + a.[i,j] * b.[j,k] c.[i,k] <- t Expect.isFasterThanSub (fun measurer -> reset(); measurer mulIKJ ()) (fun measurer -> reset(); measurer mulIJK ()) "ikj faster than ijk")
More information about this feature can be found in the docs.
A big thanks to @AnthonyLloyd for contributing this code!
Happy performance testing!
In this release I give you an improved containsAll and better string diff messages. Thanks to @MNie for his contributions again!
If you're thinking of contributing, you'll be happy to know, it's even easier to do now, since I've improved the internal tests (very meta).