#What library are you using currently for testing?
1 messages · Page 1 of 1 (latest)
Expecto. Nothing but good experiences so far :P
What kind of tests are you going to write and for what kind of project?
Actually, if I recall correctly you use JS or TS and are a web dev, just go with cypress.io, easy to set up, JS/TS, test anything, blazingly fast.
i prefer xunit, don't really love the syntax of expecto
I like fuzz testing in general
This time is just .NET code
You could know it under the term property based
Fuzz testing = property based
I might integrate that at a later point but I guess I'll go back and forth between expecto and the other common testing libraries
@twilit drift You could also do use this additionally: https://github.com/fsprojects/TickSpec
uuuuuuu, this is new and useful to me as well 🙂
Ive only used Expecto + FsCheck. Its a great improvement over my poor unit tests, but that speaks more of my skills than the frameworks. XUnit is def better for some things
I love that Expecto used to be named "Expecto-patronum"
That's an hommage to Harry Potter, where its a powerful spell to protect you from evil forces 😅
Sad, that they changed the name in 2016
@twilit drift You know FSUnit, right?
I like its fluent syntax
It has also a typed version, especially interesting looking to me ☺️
XUnit for the tooling integration, although i think VScode supports expecto reasonably well now so i might eventually transition over if I switch from Rider.
- FSCheck for property based testing, or setting MaxTest to 1 and just using it to generate random test data.
- Bogus for generating valid random data, I use this for FSCheck generators so i can just add a constrained domain type to a test and have it create something valid.
- Unquote for assertions
foo =! bar - Snapshooter for snapshot testing (e.g. json event models) that shouldn't change unless i intended it.
Love the name Bogus for such a lib 👍🏻🤪
I have a problem with it, you can't run any startup code if you use dotnet test to trigger it
also Expecto seems to be pretty dead, I'm not sure it is being maintained anymore
but I really prefer it, so I hope it gets one
Looks like for the moment I'll dive with xunit then I share the same concerns about expecto which for my purposes should be enough but worst case I switch back again
thanks y'all
If one uses XUnit, is FsUnit recommended then?
Maybe, Because they're just assertions you can mix and match. you could also use; unquote, expecto or FluentAssertions (probably not that enjoyable in F#) or even just Xunits inbuilt assertion library interchangeably. Find one that suits your taste.
I've never personally felt the need for fsunit or "fluent" assertions. But I will gladly admit to being uncultured in general, inclusive of how "functional" my code is. Usually my assertions just haven't been complex enough to really justify pulling in another library to make them feel better
That makes sense I think. FsUnit looks nice, but the F# xUnit examples I saw didn't look terrible either
I guess, as with other things, you will find more insight by actually using these libs for 5 minutes, as by studying them for weeks just in theory.
(Late to the party...)
Expecto beats the other libraries I've used as a test organization tool, by far the best in terms of making order of a messy testing project.
As for its built-in assertion library, it's... fine, I guess. For the simple tests I usually need, it's enough.
If you'd like reflection, a free debugging while testing, UnQuote is the assertion library to use, in tandem with Expecto as the organization tool!
It's got some weird syntax, and you need to learn it at first, but once you get the hang of it, it's quite nice.
Xunit is the default, and for a good reason. Don't need to dwell on it.
Lastly, as some have mentioned FsUnit is, in my opinion, a very good drop-in replacement for Xunit, even more so it's typed variant.
For Property-based testing, while I'm rooting for Hedgehog its lack of documentation, it's even worse than that of FsCheck (which is bad) means that when I do use PBT, it's FsCheck for me.
And, as some have mentioned, some utility libraries are Bogus for random data in a slew of topics and NodaTime when having to deal with date and time objects.
XUnit as of habit and simply the templates were available directly via Visual Studio.
Works well enough, I don't need super complicated combinatoric testing
We use xunit (we also have C# code, so we can use the same) together with a pimped Unquote test function using DEdge.Diffract that dumps diffs for equal checks.
I use IcuBlazor. It's a testing library written mostly in F#.
In addition to the usual asserts, IcuBlazor does visual diff testing. So you can compare (pixel-by-pixel) when a UI component changes. Also supports text diffs and FSCheck property tests.