Testing can be fun

AngularJS: end-to-end testing with Protractor 1.6

JAXenter Editorial Team
Protractor image via Shutterstock

If you’re developing with AngularJS, you can use Protractor to run tests on your application in the browser.

The larger and more complex an application is, the more complex – and nonsensical – it gets to track down bugs and carry out manual tests. While unit tests are the first choice when it comes to bugs, the integration of components may cause problems, resulting in the unit tests being ineffective.

A better way to test

For AngularJS applications, this exact scenario has been catered for by the test framework developed in Protractor, now available in version 1.6.0. As an end-to-end testing framework, Protractor works as a solution integrator, combining tools and technologies such as NodeJS, Selenium and webDriver to control browsers and simulate user actions. Here E2E testing compliments unit testing, with Protractor also allowing tests to be organized based on Jasmine, accommodating both unit and functional tests on Jasmine.

Another highlight of the release is the new Timeline plug-in which gathers test timeline information from the test process and presents the output visually. The Selenium client logs and Sauce Labs (if available) are also used. This improves understanding of where latency issues are in tests. Moreover, it’s now possible to restart the browser between tests, but this can significantly slow down the delivery of results.

Protractor is specifically tailored to make testing of AngularJS apps a breeze. It avoids using CSS attributes and writes your tests with scalability in mind. Because Protractor is a framework for the automation of functional tests, its intention isn’t to be the only way to test an AngularJS application, but to cover the acceptance criteria required by the user.

A description of other features as well as information on all changes and bug fixes can be found in the official Changelog on GitHub. If you want to get started, check out Joel Hooks’ tutorial series.

Inline Feedbacks
View all comments