manuzhang / read-it-now

Don't read it later; read it now
3 stars 0 forks source link

Minimal Scala Testing #18

Open manuzhang opened 6 years ago

manuzhang commented 6 years ago

Monix author Alexandru Nedelcu disagrees design choices of most popular testing libraries (like Specs2 and ScalaTest) and has made his own Minitest. Those libraries have a DSL mimicking human language, e.g. x shouldBe greaterThan(y), which can be simply done as assert(x > y).

Another thing that I absolutely hate are tests marked with English words like "it", forcing you to phrase the test's description in a certain way. I frequently end up with "sentences" that makes no sense

Yeah, I spend a lot of time correcting my phrases and others' when using ScalaTest. Minitest has a minimal implementation around SBT interface and integration with ScalaCheck.

With similar complaints, Li Haoyi has built uTest, containing just the features necessary to test codes. For example, it provides nice error messages without redundant matchers.

Minitest and uTest are two alternatives if you get tired of the wordy Specs2 and ScalaTest.

References

  1. Minitest: Zero Crap Scala Testing Library
  2. uTest: the Essential Test Framework for Scala