#What library are you using currently for testing?

1 messages · Page 1 of 1 (latest)

twilit drift
#

I don't usually do testing because most of my stuff is hobby, but I'm very likely to start adding tests to one of my projects and I'd like to know what others are using, I used Expecto at some point but I'm not sure if that's still viable or should I fall back to xunit/nunit/mstest

keen zenith
#

Expecto. Nothing but good experiences so far :P

mossy ivy
#

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.

low nimbus
#

i prefer xunit, don't really love the syntax of expecto

pseudo briar
#

I like fuzz testing in general

twilit drift
pseudo briar
#

Fuzz testing = property based

twilit drift
#

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

pseudo briar
mossy ivy
pseudo briar
#

I like that we finally get handy tools, to control our behavior 😄

#

Humanity 2.0

desert flax
#

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

pseudo briar
#

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 😅

#

I like its fluent syntax

pseudo briar
topaz inlet
#

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.
pseudo briar
#

Love the name Bogus for such a lib 👍🏻🤪

hardy raven
#

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

twilit drift
#

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

worthy mural
#

If one uses XUnit, is FsUnit recommended then?

topaz inlet
#

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.

static forge
# worthy mural If one uses XUnit, is FsUnit recommended then?

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

worthy mural
#

That makes sense I think. FsUnit looks nice, but the F# xUnit examples I saw didn't look terrible either

pseudo briar
#

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.

winter solar
#

(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.

native ridge
#

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

violet prairie
#

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.

main garnet
#

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.

pseudo briar
#

@main garnetInteresting!

#

And that works only with Blazor?