Book Image

Node Web Development - Second Edition

By : David Herron
Book Image

Node Web Development - Second Edition

By: David Herron

Overview of this book

Table of Contents (17 chapters)
Node Web Development Second Edition
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 9. Unit Testing

Unit testing has become a primary part of good software development practices. It is a method by which individual units of source code are tested to ensure proper functioning. Each unit is theoretically the smallest testable part of the application. For Node, you could consider each module as a unit to test individually.

In unit testing, each unit is tested separately, isolating the unit from other parts of the application. Common techniques are to use mock objects, and other methods, to fake out the dependencies, so that application units can be reliably tested in isolation. We will be focusing on that testing model in this chapter.

Functional testing doesn't try to test individual components of the system, but instead tests the whole system. Generally speaking, unit testing is performed by the software development team as they write the code, and functional testing is performed by the QA or Quality Engineering (QE) team. Both testing models are needed to fully certify...