review: JavaScript Testing with Jasmine
¶ by Rob FrieselEvan Hahn did us a favor and slapped together this primer for us: JavaScript Testing with Jasmine: JavaScript Behavior-Driven Development (O’Reilly, 2013). It’s short (around 50 pages), so you can burn through it in an afternoon, but he hits the high notes and (most importantly) provides a clear path for how to get started using Jasmine.
As a testing library, Jasmine itself is pretty approachable. It does not have a steep learning curve, and you can get some valuable results quickly just by diving in. But if you’re looking for a kind of… “guided tour” to help orient you to the library (and JavaScript testing in a more general sense) then that is where this book comes in. Hahn has peppered the text with some discussion TDD and BDD, and in some chapters there is almost as much discussion of these general development philosophies than there is of Jasmine specifically.
The book’s greatest strength (that it is so focused and concise) is also its greatest weakness — you may reach the end and wonder: “OK, what next?” Its coverage, while broad, is not particularly deep. This isn’t much of a criticism though — how deep into the innards can you really get before you’re just talking about the low-level source code? In addition to the “guided tour” approach taken by most of the book, I also appreciated the quick-and-dirty “Using Jasmine with Other Tools” chapter near the end, which is a series of overviews dedicated to the major integrations that exist. (That being said, the overviews of those integrations are just that: shallow overviews, and I would have liked to have seen at least one really deep dive. 1)
By itself, Hahn’s book is a good intro to the subject (Jasmine and JavaScript testing), and works best (again) if you’re looking for a kind of “guided tour” to help you get started. And if you are just looking for something focused on Jasmine, then this is great; and/but if you are looking for a more thorough treatment of the subject (i.e., JavaScript testing) then you’ll want to check out something like Mark Ethan Trostler’s Testable JavaScript. 2
Disclosure: I received an electronic copy of this book from the publisher in exchange for writing this review.
- I’ve written and presented on using PhantomJS to run headless automated Jasmine tests (see: headless JavaScript unit testing with Jasmine and PhantomJS), and I was hoping to see something at that depth or deeper. And that’s been my criticism of other books that start to introduce this subject, so maybe I’m just looking for too much. Or maybe I need to write that book?[↩]
- I’ve previously reviewed Trostler’s book here: review: Testable JavaScript.[↩]
Leave a Reply