Chapter 9. Testing Node applications

 

This chapter covers

  • Testing logic with Node’s assert module
  • Using other assertion libraries
  • Using Node unit-testing frameworks
  • Simulating and controlling web browsers using Node
  • Getting more details when tests fail

As features are added to your application, the risk of introducing bugs is increased. An application isn’t complete if it’s not tested, and because manual testing is tedious and prone to human error, automated testing has become increasingly popular with developers. Automated testing involves writing logic to test your code, rather than running through application functionality by hand.

If the idea of automated testing is new to you, think of it as a robot doing all of the boring stuff while you focus on the interesting work. Every time you make a change to the code, the robot ensures that bugs haven’t crept in. Although you may not have completed or started your first Node application yet, it’s good to get a handle on how to implement automated testing because you’ll be able to write tests as you develop.

9.1. Unit testing

9.2. Functional testing

9.3. Dealing with failing tests

9.4. Summary

sitemap