Writing Human-Readable Assertions with Matchers
Learn another way to write test cases in ScalaTest that matches DSL.
Defining matchers
Assertions are low level and don’t enforce any writing style. ScalaTest lets us write more expressive assertions using its matchers. Matchers come in two types, must
and should
. In this lesson and some that follow, we’ll explore the main should
matchers that ScalaTest defines. The must
matchers work exactly the same way. In the end, choosing between should
and must
is a matter of personal preference.
Our TestSuite
definition now looks like this:
Get hands-on with 1400+ tech skills courses.