Chapter 14. Application testing
This chapter covers
- Using Scala testing frameworks
- Writing testable code
- Using Lift’s TestKit
Testing is an important part of the modern application development lifecycle, and testing web applications comes with its own unique problems. This chapter deals with testing as an independent entity, away from the main development of an application. Broadly speaking, you should really write tests iteratively, while you’re developing an application, to ensure that all the great new features you’re adding don’t break any of the existing functionality. With that being said, testing is covered here in one homogeneous block, so be sure to take what you learn in this chapter and apply it within each iteration of your development cycle.
With Scala being based on the JVM and sharing a great deal of common ground with Java, you have a plethora of testing tools available to choose from. Popular Java testing tools like JUnit (http://www.junit.org/) will still work with your Scala code, but the first section of this chapter focuses on the testing tools that have come from the Scala ecosystem and gives you an introduction to three popular testing tools:
- ScalaTest—http://www.scalatest.org/
- Specs—http://code.google.com/p/specs/
- ScalaCheck—http://code.google.com/p/scalacheck/