Before jumping into the testing waters, it makes sense to have a plan of what we should test and why. The term test plan is heavily overloaded with many potential interpretations as processes, literature, and practices have been prevalent and continuously evolving for decades. It is not surprising that modern test plans can range from casual, mostly ad-hoc practices to formal, 100-page documents requiring executive sign offs at various stages.
For a more detailed discussion on the test plan practices applied to modern JavaScript applications, see the JavaScript Testing Beginner's Guide by Yuxian Eugene Liang (http://www.packtpub.com/javascript-testing-beginners-guide/book).
As Backbone.js applications are typically created in iterative development cycles, often without a lot of extra formality, we will take a fairly practical approach and create a test plan that simply identifies testing categories and applies them to the application under test. While an actual planning document or wiki is a best practice, it is not absolutely necessary. The overriding point is being able to identify what tests are appropriate for a given piece of code or feature during development.
We will focus on a few of the many overlapping concepts within the auspices of a test plan:
Unit tests take a narrow view and are often used by a developer to set forth a set of required behaviors for the small piece of code they are presently working on. Then, the code is developed to match up with the unit test assertions. Partial integration tests take a higher-level view, piecing together the application and checking that the individual components add up to a functional whole. In an exemplary Backbone.js application, a unit test might create a single model and test-only model methods. In contrast, a partial integration test might create a view with several subviews and a collection and verify that collection data changes modify the subview display.
Other concepts that we will not explicitly cover in this book, but that are worth becoming familiar with and integrating into the overall development and testing process, include:
Now that we have had a brief introduction of these various testing concepts, we will develop an informal test plan for our Backbone.js application. We will examine the various parts of our Backbone.js application and identify what needs to be tested, what type of tests we should apply, and the behavior that we need to verify in the application. For the parts of an application that are still in development or in the early design phases, we'll go through the same exercises, just with a focus on the behaviors we expect the application to exhibit once it has been developed.
3.137.172.115