Jump to ratings and reviews
Rate this book

Testing in Scala: Scala Tools for Behavior-Driven Development

Rate this book
If you build your Scala application through Test-Driven Development, you’ll quickly see the advantages of testing before you write production code. This hands-on book shows you how to create tests with ScalaTest and the Specs2―two of the best testing frameworks available―and how to run your tests in the Simple Build Tool (SBT) designed specifically for Scala projects. By building a sample digital jukebox application, you’ll discover how to isolate your tests from large subsystems and networks with mocking code, and how to use the ScalaCheck library for automated specification-based testing. If you’re familiar with Scala, Ruby, or Python, this book is for you.

163 pages, Paperback

First published January 1, 2013

5 people are currently reading
104 people want to read

About the author

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
3 (6%)
4 stars
16 (35%)
3 stars
17 (37%)
2 stars
7 (15%)
1 star
2 (4%)
Displaying 1 - 6 of 6 reviews
Profile Image for Rod Hilton.
152 reviews3,116 followers
August 23, 2017
I've been working with Scala for around 6 years now, and finally left the job where I learned it for another job also using Scala. I'm a huge fan of unit testing and test-driven development, but at my previous gig we all used a scala testing framework and mocking framework developed in-house, meaning 100% of my scala testing experience was with something that I'd be unable to transfer to the new job. Testing in Scala seemed like the perfect book to round out this missing skillset for me.

Unfortunately, the book is fairly disappointing. Frankly, it contains no more information than reading the tutorials and documentation for ScalaTest, Specs2, and ScalaCheck. In fact, I think the book contains LESS information than those tutorials and user guides, it only barely covered writing custom matchers and left out a lot of more advanced material.

I guess I expect a bit more from an actual book, maybe cover the API basics and then get into usage patterns, best practices, advanced usage, and so on. If you're charging someone money for the words, it seems like it should contain more information than what's free on the web site for the technologies being covered, I think. Hell, I could have written this book just from following those tutorials, having never worked with or achieved expertise with the technologies in question. There's no meat here.
Profile Image for Michael Koltsov.
110 reviews69 followers
January 17, 2014
Intent for reading this book was trivial. I needed it to take full responsibility for testing an application at my job. This doesn’t happen every day. Most of the books I’ve read had no trivial connection with the things I do for living. That was an exception. I hope that in future it will happen more often. One of the most exciting things I find in IT is an ability to use the newest technology(sometimes inmature) available.

I hope it didn’t sound as bloated as it seems to me =) The job I needed to do was as simple as usual. There were a bunch of JUnit tests, I needed a tool to write more of them with a speed of sound. The most obvious thing for me was to refactor the existing test codebase to bring some Scala seasoning in it. That took almost no time, thanks to Maven and it’s Scalagen plugin.

While looking at Junit tests written in Scala, Spring and Hamcrest I had a feeling that I’ve missed something. Scala syntax was consise, but the style of writing the unit-tests was still Java-like. That means it was bulky and too verbose.

Here comes the «Testing in Scala» book. If every book is considered to be a motor ride this particular book would be a driving on a highway in a sports car.

It gives you only what you need. The introduction to Scala-esque way of writing a unit test, all popular frameworks are included.

There’s no much talk about the trivial things like some other books. Only brief recital of how to write consise tests in JUnit and how to use ScalaTest, Scalacheck etc. You could read it throughout a day! I like the book so much that i’ve started to use most of the things from it in my own projects.

If you find yourself writing a test in any Jvm — based language you should consider reading this book.

My score 4/5
Profile Image for Stefan Teixeira.
27 reviews4 followers
July 2, 2015
This is a great book about Scala testing. In fact, I never worked with Scala before and, after reading the book, I could start to do some unit tests for an application in a previous company I worked for.

The only issue I had was with ScalaMock. The book covers the tools using Scala 2.9, and this app I mentioned was developed with Scala 2.10. Unfortunately ScalaMock had most of its API cutted off in Scala 2.10, which made testing more challenging.
Profile Image for Michael.
31 reviews
July 1, 2013
Good stuff, definitely got me bootstrapped on using mocks. A little thin, but the language is growing so quickly, I'm frankly suspicious of 300-page tomes; they will date rather quickly.
Displaying 1 - 6 of 6 reviews

Can't find what you're looking for?

Get help and learn more about the design.