Base test classes
ScalaTest consists of lots of lightweight traits that are focused around solutions for similar or unique problems. This allows us to mix them together to solve the problem in hand.
Testing convention dictates that instead of mixing the same traits in all tests, we create a base class, which mixes all the required traits used by all the tests in the application. This gives a uniform DSL across all tests in the project. There may be cases when one particular tests need to mix a few more traits, and it's fine to do so for those individual tests.
We will be using the same principle in our example application that we wrote in previous chapters. We will create a base class that we will endeavor to reuse for all the tests. At this point, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access