O'Reilly logo

Scala Test-Driven Development by Gaurav Sood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required