Testing AngularJS Applications in the IDE
Categories: Angular Angular JS
Testing AngularJS Applications in the IDE
As I mentioned in the previous chapter, there are two types of tests that are used for testing AngularJS applications. The first type of test is the unit test. Unit testing is usually the first place where issues with the code are found, through testing small units of code. The second type of test is end-to-end (E2E) testing. E2E testing helps to identify software defects by testing how components connect and interact together as a whole.
NetBeans can easily work with both JsTestDriver and Karma for unit testing AngularJS applications. Karma is quickly becoming the most popular choice for AngularJS development teams, so we will focus more on Karma in later chapters. Protractor is the most popular test framework for E2E testing of AngularJS applications. Currently, most development environments don’t have built-in support for Protractor. Protractor is a new testing framework, and it may take a while before most IDEs and editors support it.
NetBeans currently has no support for Protractor.
Both Karma and Protractor run on Node.js. Node.js is an open-source cross-platform framework built on the Google V8 JavaScript engine. We will use Node.js later in this book when we focus on building MEAN stack applications. Installing Karma and Protractor is a relatively easy process that uses the Node.js package manager (npm) for the installation process.
Node.js-based projects use a JSON file named package.json as the project configuration file. The following is a standard package.json file used in a NetBeans project. If you look at the dependencies section of the file, you will see that we actually define Karma as a dependency of the application.