Tamer Safwat’s review about JavaScript Unit Testing Book

Attached below the review of Tamer Safwat (Staff Software Engineer at Disney) about the “JavaScript Unit Testing” book:

JavaScript Unit Testing

JavaScript Unit Testing Book

Great book
“This is the most comprehensive and practical JavaScript unit testing reference I found and maybe the only one out there.

Not only the author is covering the most popular frameworks for JavaScript unit testing, he is also covering tools and plugins required to build an efficient testing environment.

The book has plenty of code samples which not only explain different unit testing scenarios but also explain many JavaScript and web programming best practices and concepts.

Overall this is a great book and a must have for anyone doing serious JavaScript work.”


The book on PacktPub:

JavaScript Unit Testing Book Review by Mihai

Attached below the review of Mihai about the “JavaScript Unit Testing” book:

JavaScript Unit Testing

JavaScript Unit Testing Book

Great Book!
“I’ve just read the JavaScipt Unit Testing book and I found it very useful for professionals that need to implement or upgrade their strategy for Unit Testing.
The greatest gain, I believe, is the excellent explanation on how to use tools for Unit Testing like Jasmine, YUI, QUnit and JsTestDriver.
Great book!”


The book on PacktPub:

Review #3 about the JavaScript Unit Testing Book

Attached below the review of Werner Punz (Senior software developer for Irian GmbH. Vienna, an Apache MyFaces Committer Member of the JSF Expert Group and a JavaScript expert) about the “JavaScript Unit Testing” book:

JavaScript Unit Testing

JavaScript Unit Testing Book

Just read the book
“The book is very good, it covers the theory behind unit testing and then goes into details by applying various unit testing frameworks in a small and a real world Ajax example.
The testframeworks covered are

– Jasmine
– YUI Test
– QUnit

This book is a must read for everyone interested into Javascript unit testing, especially if you have to cover asynchronousity via Ajax (which is a key focal point through the entire book, in the more complex example).

Overall a very good book. Five stars from me.”


The book on PacktPub:

Review #2 about the JavaScript Unit Testing Book

Attached below the review of Juanjo Fern├índez about the “JavaScript Unit Testing” book:

JavaScript Unit Testing

JavaScript Unit Testing Book

Improving your JavaScript code
“I suppose at least in a generic way you know what is unit testing, but to sum it up in a few words, according to Wikipedia:

Unit testing is a method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine if they are fit for use.

By starting an application development, when it has relatively few lines of code all “fits” perfectly, but later when you want to add, modify, or delete certain functionality, this can become a big problem since when changing anything probably you will be breaking a few by the way.

Thanks to unit testing you can modify any module in your code, launch the tests, check failures, correct, and ready. Everything will still work in a clean, quick, and tidy way.

Once completed this short introduction, I’m going to review a book I’ve been reading these days and is about this theme: JavaScript Unit Testing:

Chapter 1 – Unit Testing JavaScript Applications: You’ll find the only theoretical part of the entire book on the first pages of this chapter, where you’ll learn what are the unit tests, why they are needed, and different approaches to create the tests: traditional unit testing and TDD.

Once this part is completed, you’ll see how works the application on which you’re going to make all the tests you’ll find in the book. It’s an application with the backend programmed in Java and a good amount of JavaScript in the frontend, that it really is what you’ll be interested to make the tests. The application allows you to complete a new user registration, authenticate and check the weather in some cities.

Don’t be scared by the fact that the application’s backend is programmed in Java: you won’t see anything of Java throughout the entire book however if you want to run the application in your computer, you’ll need to install Apache Tomcat.

Chapter 2 – Jasmine: Jasmine is a behaviour-driven development framework for testing JavaScript code. The behaviour-driven development is based on TDD.

The Jasmine test cases give more importance to the application business value over the technical details. Also are written in natural language so they can be understood by people without technical background.

In this chapter you’ll learn to install, configure and write tests with Jasmine on the application JavaScript code you saw in the first chapter, including Ajax.

Finally you’ll use together jQuery and Jasmine thanks to an available plugin that allows an easy integration between these 2 frameworks.

Chapter 3 – YUI Test: In this chapter you’ll learn to use one of the most popular unit testing frameworks: YUI Test.

YUI Test is part of the open source library for JavaScript and CSS called YUI, but with YUI Test you can test any JavaScript code, even if you don’t use YUI.

As with the previous chapter with Jasmine, in this case you’ll make unit testing with YUI Test on simple JavaScript code for later create the necessary unit testing for the application included with the book.

In addition to this you’ll see how to automate your unit testing integrating YUI Test with Selenium Driver.

Chapter 4 – QUnit: The third unit testing framework that you’ll learn to use is QUnit. It’s the framework used by all the projects related to jQuery (jQuery, jQuery UI, and jQuery Mobile) but you can use it to test any JavaScript code.

QUnit is very popular and has a simple syntax that allows you to run the tests from a browser.

Like in previous chapters, you’ll see how to install and configure QUnit, run your firsts tests, and once you’ve got a solid basis create the necessary tests for the weather application.

Chapter 5 – JsTestDriver: JsTestDriver (JSTD) is one of the most powerful frameworks for unit testing because in addition to the framework, it incorporates a test runner that can run other unit testing frameworks. All contained in a JAR file that includes everything you need to start to create your tests.

This last chapter goes similar path than previous: you’ll learn to install and configure JsTestDriver, you’ll make basic unit testing to learn its functioning and at last you’ll create the tests for the application you already know, but also you’ll learn to generate complete reports with the testing data, and to integrate JSTD with other JavaScript frameworks like Jasmine or QUnit.

Finally you’ll see how to integrate JSTD with the Eclipse IDE thanks to the JSTD Eclipse plugin.

It’s a short book compared with other books published by PacktPub but the content quality hasn’t been reduced. In any case I’ve missed information about other frameworks based on node.js that are becoming very popular like Mocha or CasperJS.

Another thing that could have improved is the application included with the book code. Since it’s a book about JavaScript it should be an application developed with node.js and not with Java, further it would have been easier to run on your computer, since to run the included application you need to install Apache Tomcat.

Beyond these minor flaws that I mentioned, It’s a highly recommended book, which includes a wealth of information and code from the most popular unit testing frameworks in the JavaScript community.

When you have finished reading it you will have a strong foundation to begin creating unit tests for your applications, which will improve your code and will optimize the time that you spend to modify existing applications.”


The book on PacktPub:

Review #1 about the JavaScript Unit Testing Book

Attached below the review of Zubin Wadia (the CEO & Co-Founder of CiviGuard, Inc, CEO & Co-Founder of RedRock IT Solutions, and Chief Technology Officer at ImageWork Technologies) about the “JavaScript Unit Testing” book:

JavaScript Unit Testing

JavaScript Unit Testing Book

A Key Book for Complex Javascript Projects
“Javascript Unit Testing does a phenomenal job covering the Javascript Unit Testing landscape. As Javascript becomes faster and faster within the confines of a Browser, it becomes more likely that complex code will be written with it. It is also natural that larger teams will be writing code for these projects across a variety of modules and separations of concern. All these factors increase the need for disciplined Unit Tests to be written, using some of the most prominent tools available today.

Hazem Saleh sets the book up in the first chapter by emphasizing the WHY around JS unit testing, their purpose in a code-base and how they should be written/designed. If you are a seasoned programmer with a solid unit test writing habit, this chapter is less useful, and you can proceed to the next few chapters. The author also introduces the reader to an appropriate sample application that gives us a canvas on which to apply the fundamentals and variety of Unit Test tools and frameworks in subsequent chapters. The example is a classic weather-oriented one, yet complex enough to put the power and need for JS unit testing into perspective.

Chapters 2-5 walk you through some of the most prominent tools for JS unit testing available today: Jasmine, YUI Test, Q Unit and JSTD. Each one has its own quirks and idiosyncrasies that are competently elaborated upon and applied to the Weather Application sample by the Author. Two other aspects I liked about the book were (1) the Author’s care to include configuration instructions and architecture reviews for frameworks that had some pre-preparation required before you could get into them (2) the progression from some of the lighter-weight frameworks (Jasmin) to the most complex and comprehensive (JSTD). JSTD is a natural capstone chapter for the book given that it has the ability to integrate the other frameworks within its Test Run suite.

All in all, an essential book if you are a good JS developer looking to become great at what you do, and perhaps lead a team in writing orderly and well engineered code on what is the heart of the web today!”


The book on PacktPub: