9 Testing and Debugging AngularJS Applications
WHAT YOU WILL LEARN IN THIS CHAPTER:
- The testing pyramid as applied to AngularJS apps
- Unit testing with Mocha, Karma, and NodeJS
- Provisioning cloud browsers with Sauce
- Integration testing with ng-scenario and protractor
- Effectively utilizing the debug module
- The basics of the Chrome developer console
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
You can find the wrox.com code downloads for this chapter at http://www.wrox.com/go/proangularjs
on the Download Code tab.
ANGULARJS TESTING PHILOSOPHY
A little-known fact about AngularJS is that the original author, Misko Hevery, was a test engineer at Google when he first wrote <angular/>, as it was then called. His role as a test engineer involved educating Google engineers on utilizing practices like dependency injection to write modular code that was easy to unit test. Unsurprisingly, AngularJS was designed to make writing unit-testable code easy from day one. This is why AngularJS is known as a framework rather than simply a library: Controllers, services, and directives provide an opinionated structure for how code should be written. Libraries like jQuery simply provide helper functions for writing code any way you please.
The first step toward understanding AngularJS’s testing philosophy is to understand what a unit test is. The term unit test is often tragically misused by software engineers; if you are already familiar with an alternative definition, please remember ...
Get Professional AngularJS now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.