For those who have had no professional experience with Backbone.js there will be a small amount of ramp up required to understand some of the concepts introduce. However, Backbone.js is designed after a fairly well known software design pattern that many front-end developers have come across, called model view controller (MVC). Backbone.js is a minimalist implementation of the pattern, and provides an effective way to organize web application code for maintainability. Ryan does a good job of quickly introducing Backbone.js, so fear not it is not absolutely necessary to have built software with Backbone.js. Of course for those who have had exposure to Backbone.js, Ryan will keep your interest by detailing several new tools that complement the framework.
The book begins with an overview of the tools, infrastructure, and methodologies Ryan will introduce to test a Backbone.js web application. Roemer starts by walking through machine preparation, think of this as test bench creation. A good level of exposure to github and UNIX based operating systems will make this section quick and easy. Roemer describes the directory structure to start with, it will make referencing a lot easier later. Along with a Backbone.js application, the test infrastructure is introduced and installed. These tools are Mocha, Chai, and Sinon.JS test libraries. It is recommended that before you get started that you take some time to browse these tools online. There is a lot of development on these tools and it’s always good for more context and reference.
Ryan does a good job describing the utility of each tool and sets the stage for things to come. You will be introduced to the concept of test cases and test reports. He will have you run your very first test case. Ryan provides all the needed links, paths, and code to achieve each task. Be sure to read his extra notes for all the "gotcha's".
Next, you are introduced to the application under test. Ryan provides a fully implemented Backbone.js application. With little exposure to Backbone.js, a novice will quickly wrap their head around this application and all its different pieces. There are a few different components to a Backbone.js application and you learn how each interfaces with the framework. The application under test is called Notes, and it is a basic “sticky note” like application. Each of the major functional components is described so that later you can plan where to focus your testing efforts. The application is pretty impressive in size, and you don’t regularly find a book with such a robust example. Give kudos to Ryan for providing a great example application. Make sure to download the application and play around with it. Get a sense for the functionality and put some extra thought into areas you think bugs could live.
The core subject matter is detailed in the third chapter of the book. Ryan takes a deep dive into a few test methodologies, test planning, and test case authoring. In this chapter you will learn about unit testing and integration testing and the roles they play. It will detail Behavioral-Driven Development and Test-Driven Development. Behavioral-Driven Development (BDD) is a great paradigm for describing test cases, you will find it refreshing. Be sure to study this chapter, it is critical to understand. If you find it hard to follow along, you should spend a little more effort taking notes and following up with online research. In the later chapters you will build on this foundation of knowledge. Roemer clearly introduces concepts and openly admits to showing application implementation first and test cases second. If you are familiar with Test-Driven Development, you may want to see how the book would read if Ryan had introduced the concepts in true Test-Driven Development fashion.
The last chapter Ryan offers an additional test approach. You learn about a new tool called Phantom.js, a headless browser for testing a web application. Phantom.js is an integration test framework. Phantom.js can automatically test components when they are glued together and executing in a browser container. This subject could have had a few chapters written on it, but you are instead introduced to the topic and provided with additional resources to follow up with on your own time.
Roemer provides a well-planned set of steps for building a comprehensive test strategy for a Backbone.js web application. The book clearly delivers on the topic and readers who are looking for a set of tools and a good reference for using them to test better won’t be disappointed. The book is only 147 pages, so take care with the topics; there can be a lot of information in a relatively short amount of time. Take notes and follow along with the examples as Ryan suggest, and most of all have fun.
Kyle McFarland, co-founder and engineer at a Seattle startup.
Link to Original Source