Book Image

Ext JS Application Development Blueprints

Book Image

Ext JS Application Development Blueprints

Overview of this book

Table of Contents (18 chapters)
Ext JS Application Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Total testing


In this chapter, we'll cover two types of test, one at the detail level and one at the "big picture" level. The first, unit testing, is great for helping with the algorithms and calculations that often make up business logic; the second, integration testing, helps us make sure that customer requirements are met and the user experience is sound. Let's look at each in turn.

Unit testing

With unit testing, we unsurprisingly test a unit, a unit being an individual unit of code. This will generally be a whole class, but will focus on a single method depending on the circumstances. In a unit test, we'd be able to say something like this:

Create cart object
Add product #1 to cart
Add product #1 to cart
Assert that there is only one item in the cart

To set up the test, we add the same product to the cart twice. This should result in one line item with a quantity of two rather than two line items, each with a quantity of one. In the first test, we make the assertion that the cart count...