Get Started with Protractor Testing for AngularJS

Posted Apr 6th, 2016

How do you test your AngularJS applications? With Protractor. Protractor is an end-to-end testing framework for AngularJS applications. This getting started guide is for new software developers in test who are interested in learning about Protractor testing. By following this getting started guide, you’ll understand how to build a firm foundation and learn fundamental Protractor testing for AngularJS applications.

Build a solid foundation

To build better software tests, you’ll need a solid base of the technologies behind your application, which teaches you the principles that will be essential when coding, executing and debugging your tests. Let’s focus on the correct learning path for Protractor testing. This is the age of JavaScript (JS) applications and frameworks. JavaScript is the foundation and critical learning block needed to be successful with Protractor testing, and what follows is your roadmap to learn JavaScript, NodeJS, and AngularJS for Protractor testing.

JavaScript is a very significant piece of the front-end development stack. How much JavaScript knowledge do you need to have before jumping head-first into frameworks like NodeJS, AngularJS, and Protractor? All of them are based on JavaScript, so you need to have a solid grasp of pure JavaScript before jumping to any of these frameworks or libraries. Just note that during the journey of learning AngularJS and NodeJS that they are two different things. AngularJS is for front-end development, and NodeJS is for server-side. I suggest you start learning core JavaScript before jumping into the other frameworks and libraries.

Dedicate the time to learn and master Javascript functions, events, error handling, errors and debugging before starting the Protractor testing journey. NodeJS is for server-side, and I only suggest taking a quick crash course.

AngularJS has become the go-to JavaScript framework for enterprises and large companies’ front-end development. The baked-in directives are the most important and complex component in AngularJS and Protractor testing, which raises the importance of building directive strategies for testing, from Developer to Automation Engineer collaboration.

Protractor supports AngularJS directive strategies, which allows you to test AngularJS applications without much effort. Protractor is a Node program, which is a wrapper around WebDriverJS. I recommend skimming through the WebDriverJS Users Guide, Protractor API and Protractor Style Guide before writing any tests. Protractor uses Jasmine or Mocha for its test syntax.

Jasmine and Mocha are very similar, behavior-driven development frameworks for testing JavaScript code. What is the point of learning all of these languages and frameworks? At the end of the day, end-to-end tests fail and will be tough to debug. It will also be difficult to locate root causes. Without a core foundation of Javascript, NodeJS and AngularJS would make debugging tough.

Getting started with some fundamentals of Protractor under your belt

How Protractor works and interacts with AngularJS (workflow) Protractor Components - Sauce Labselementor will test it against a live protractor instance. Elementor is considered an improved element finder for Protractor.


This article isn’t a complete list of resources — just a starting point for new software developers in tests who are interested in learning about Protractor testing. Keeping up-to-date on front-end technologies can be exhausting, but with a core JavaScript foundation, you will be fine.

Greg Sypolt (@gregsypolt) is a senior engineer at Gannett and co-founder of Quality Element. He is a passionate automation engineer seeking to optimize software development quality, while coaching team members on how to write great automation scripts and helping the testing community become better testers. Greg has spent most of his career working on software quality — concentrating on web browsers, APIs, and mobile. For the past five years, he has focused on the creation and deployment of automated test strategies, frameworks, tools and platforms.

Written by

Greg Sypolt


Automated Testing