Book Image

Scala for Java Developers

By : Thomas Alexandre
Book Image

Scala for Java Developers

By: Thomas Alexandre

Overview of this book

Table of Contents (19 chapters)
Scala for Java Developers
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 4. Testing Tools

No matter which language you are programming in, testing should be performed with great care, as it will not only document your code in a consistent way but will also be of great help for refactoring and maintenance activities, such as fixing bugs.

The Scala ecosystem largely follows Java trends towards testing at all levels, but with some differences. At many places, we will see that Scala is using DSLs (Domain Specific Languages), which makes the testing code very clear to read and understand. As a matter of fact, testing can be a good area to start with when introducing Scala, migrating progressively from an existing Java project.

In this chapter, we are going to cover some of the major testing tools and their usage through a number of code examples. We have already written a tiny JUnit-like test in Scala in Chapter 3, Understanding the Scala Ecosystem, so we will go from here and focus on BDD-style tests that belong to Behavior Driven Development (BDD). Agnostic...