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