Test-Driven JavaScript Development (Developer's Library) and over one million other books are available for Amazon Kindle. Learn more
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See this image
Sell yours for a Gift Card
We'll buy it for $14.43
Learn More
Trade in now
Have one to sell? Sell on Amazon

Test-Driven JavaScript Development (Developer's Library) Paperback – September 19, 2010

ISBN-13: 978-0321683915 ISBN-10: 0321683919 Edition: 1st
Buy used
Buy new
Used & new from other sellers Delivery options vary per offer
50 used & new from $28.95
Amazon Price New from Used from
"Please retry"
Paperback, September 19, 2010
"Please retry"
$33.58 $28.95
Free Two-Day Shipping for College Students with Amazon Student Free%20Two-Day%20Shipping%20for%20College%20Students%20with%20Amazon%20Student

Hero Quick Promo
Save up to 90% on Textbooks
Rent textbooks, buy textbooks, or get up to 80% back when you sell us your books. Shop Now
$40.43 FREE Shipping. Only 3 left in stock (more on the way). Ships from and sold by Amazon.com. Gift-wrap available.

Frequently Bought Together

Test-Driven JavaScript Development (Developer's Library) + JavaScript: The Good Parts + Secrets of the JavaScript Ninja
Price for all three: $90.29

Buy the selected items together

Editorial Reviews


“A simplified and well-explained book about one of the most underestimated parts of any application life-cycle. Christian Johansen brings real world examples, simple to advanced, and a useful library together in one place. I couldn’t expect more from Test-Driven JavaScript Development. Excellent learning and definitively easy to read.”

—Andrea Giammarchi, lead developer, NOKIA Gate 5 GmbH


“A great mix of theory and practical examples makes this a good read for both newcomers to JavaScript/TDD and seasoned JavaScripters wanting to add to their skill set.”

—Jacob Seidelin, freelance web developer, Nihilogic

From the Back Cover

"An essential reference for the social web, present and future… a must-have for making your website known on the social graph.

-- Joshua Gross, president, Cortex Creations, LLC


For JavaScript developers working on increasingly large and complex projects, effective automated testing is crucial to success.Test-Driven JavaScript Developmentisa complete, best-practice guide to agile JavaScript testing and quality assurance with the Test-Driven Development (TDD) methodology. Leading agile JavaScript developer Christian Johansen covers all aspects of applying state-of-the-art automated testing in JavaScript environments, walking readers through the entire development lifecycle, from project launch to application deployment, and beyond.


Using real-life examples driven by unit tests, Johansen shows how to use test-driven development (TDD) principles to gain greater confidence in your code base, so you can fearlessly refactor and build more robust, maintainable, and reliable JavaScript code at lower cost. Throughout, he addresses crucial issues ranging from code design to performance optimization, offering realistic solutions for developers, QA specialists, testers, and other software professionals.


Coverage includes

  • Understanding the concepts of automated tests, TDD, and unit testing
  • Building effective automated testing workflows
  • Choosing the right unit testing framework for your needs
  • Writing more modular and testable code
  • Testing code for both browsers and servers (using Node.js)
  • Using TDD to build cleaner APIs, better modularized code, and more robust software
  • Using test stubs and mocks to test units in isolation
  • Continuously improving code through refactoring
  • Walking through the construction and automated testing of fully functional software
  • Writing superior unit tests


About the Web Site


The accompanying Web site, tddjs.com, contains all of the book's code listings and additional resources.



Shop the New Digital Design Bookstore
Check out the Digital Design Bookstore, a new hub for photographers, art directors, illustrators, web developers, and other creative individuals to find highly rated and highly relevant career resources. Shop books on web development and graphic design, or check out blog posts by authors and thought-leaders in the design industry. Shop now

Product Details

  • Series: Developer's Library
  • Paperback: 600 pages
  • Publisher: Addison-Wesley Professional; 1 edition (September 19, 2010)
  • Language: English
  • ISBN-10: 0321683919
  • ISBN-13: 978-0321683915
  • Product Dimensions: 7 x 1.3 x 8.9 inches
  • Shipping Weight: 1.8 pounds (View shipping rates and policies)
  • Average Customer Review: 4.1 out of 5 stars  See all reviews (21 customer reviews)
  • Amazon Best Sellers Rank: #683,731 in Books (See Top 100 in Books)

More About the Author

Discover books, learn about writers, read author blogs, and more.

Customer Reviews

4.1 out of 5 stars
Share your thoughts with other customers

Most Helpful Customer Reviews

15 of 16 people found the following review helpful By P. Hodgson on March 9, 2011
Format: Paperback
I initially picked this up hoping to learn some stuff about the mechanics of unit-testing in javascript, and maybe some stuff about how to organize your javascript in a testable way. I was very pleasantly surprised to find a book which covers way more.

You'll learn about the fundamentals of modern functional javascript. You'll discover that it's not class-based OO and that functions, closures and object literals are your building blocks.

You'll see some neat, slightly mind-bending way of implementing things. A tiny example - why not keep track of whether a stub function has been called by just setting a bool on the stub function itself!

Most of all, you'll see that it's very feasible to develop real grown-up software using a true test-driven-DESIGN approach using javascript. You'll also get the benefit of being walked through a load of deep, hands-on practical examples covering both server-side JS, client-side DOM-based JS. This material can be pretty dense; I expect to re-read most of the book again at some point.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
9 of 9 people found the following review helpful By Magnar Sveen on May 13, 2011
Format: Paperback Verified Purchase
Let's be frank: Even if you're not that into test-driven development, this is the book you want.

In this book, Christian displays stunning prowess with the JavaScript language, and he's more than willing to share. You'll learn the intricacies of the language, see best practices for working with the dom, code reuse and object oriented design, functional programming, server-side scripting, and everything done in a test driven fashion.

If you're new to the language, this is the best way to avoid all the outdated advice that plagues many of the other javascript-books. If you're a jQuery ninja, this is your chance to learn that JavaScript has a lot more to offer. And even if you're already a JavaScript expert, I guarantee you'll find a few new useful tricks either way.

And let's not forget: At the end, you'll definitely be into TDD too.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
11 of 12 people found the following review helpful By Jim McGaw on December 3, 2010
Format: Paperback
I'm a Django web developer, and like most of us, the unit test coverage for my projects ends where the client-side code begins. I found this book to be extremely useful in teaching how to create tests for JavaScript. The book uses JsTestDriver, which I had never heard of before the book, but is an amazing cross-browser test runner.

The book is written in three parts. The first is an overview of TDD, the second covers JavaScript as a programming language, and third talks about how to integrate JavaScript testing into a project. The first part is short, and the third is, naturally, the meat of the book. The second part, which introduces JavaScript, seems superfluous given the intended audience. It's a good refresher, but the third part builds upon the second one, so part two can't be skipped. It would have been great if the second and third parts would have been more decoupled.

Besides that, is there any web developer that wouldn't benefit from learning how to treat JavaScript as a real soup-to-nuts programming language?
2 Comments Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
16 of 19 people found the following review helpful By George Jempty on November 25, 2010
Format: Paperback
Unlike the first reviewer I've actually begun reading this book. Based on the first 2.5 chapters I can tell you without reservation that this author is quite knowledgeable about both Javascript and Test-driven development (TDD). Not only is the book technically excellent in this regard, but the author is also not afraid to state his opinion and challenge conventional wisdom, for instance when addressing the oft-misunderstood issue of temporarily hard-coding data to make tests pass. Furthermore, if you have comments or questions about the book in other online forums such as a blog, the author is very quick to respond. Addendum: having pretty much completed the entire book I will add, there is much excellent introductory material regarding Ecmascript 5 included.
1 Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
3 of 3 people found the following review helpful By Kjell-Morten Bratsberg Thorsen on January 3, 2011
Format: Paperback Verified Purchase
As the title suggests, this book gives you a walk-through on how to bring the test-driven development process to your JavaScripts. There's a short and practical introduction to TDD thinking and the tools available, and the main part of the book revolves around the building of a chat client to demonstrate different principles of TDD.

In addition, you'll get a section on programming practices unique to JavaScript. This section might feel a bit out of place, but actually it's more of a hidden treasure. It's a really great, no-nonsence introduction for programmers coming from other languages. This is nothing like a JavaScript 101. The author expects you to know the basics of the language, and jumps straight to best practices and advanced themes.

For web developers that have been focusing on back-end development, while treating JavaScript just as a way to add some effects on top, this is a really great book for getting serious and up to speed with JavaScript development as well. Highly recommended!
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
2 of 2 people found the following review helpful By Larry Battle on August 27, 2011
Format: Paperback Verified Purchase
I bought this book to get a deeper understanding of Javascript and to figure out what TDD (Test Driven Development) was. After finishing this book in 2 weeks, I feel that my goals have been accomplished.

Christian Johansen did a excellent job writing Test Driven Javascript Development.
The overall structure is well organized, the code is easy to read with concise explanations and examples are plentiful.

The first part of the book gives you a general overview of TDD and unit testing and code quality tools.
Afterwards, you move on to learning about the basic, advance and future elements of Javascript. Example topics include function creation, binding, different ways to perform inheritance, closure, and ECMAScript 5.

Lastly, the rest of the book is dedicated towards getting you into the mindset of a TDD developer by building small web applications with the author. This means that each section go like this.

Write a test case.
Watch it fail.
Program it to pass.

I found it amazing what you can do with the Assert, Stub, Mock and Spy functions.

One thing that I've been noticing is that writing test cases takes a LONG time when you first start out as beginner.
Also, I found it hard to avoid testing implementation rather than states and behaviors. But I guess making good test cases comes with experience.

One problem that I faced was that jsTestDriver (the preferred unit testing framework through the book) doesn't work well with jQuery plug-ins. So I ditched it and went with SINON.JS + QUNIT.js. Ever since then I haven't had any problems writing and testing test cases.

I highly recommend this book for anyone curious about Test Driven Development, Unit Testing or wishing to better understand and improve their Javascript.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again

Most Recent Customer Reviews

Set up an Amazon Giveaway

Amazon Giveaway allows you to run promotional giveaways in order to create buzz, reward your audience, and attract new followers and customers. Learn more
Test-Driven JavaScript Development (Developer's Library)
This item: Test-Driven JavaScript Development (Developer's Library)
Price: $40.43
Ships from and sold by Amazon.com