End to End (E2E) Testing and Protractor: A Developer Perspective

End-to-end testing is a methodology used to test whether the flow of an application is performing as designed from start to finish.  This becomes essential as an application grows in scope and complexity and it becomes unfeasible to manually test for new features, catch bugs and notice regressions.  These types of tests are also meant to capture bugs that come up during the integration between components that would not be caught during unit tests. For those unfamiliar with unit testing, it focuses on testing small individual “units” of source code.

Protractor

We develop almost all of our web applications with a purely AngularJS front end at the lab.  For our E2E framework we chose Protractor, which was specifically designed for AngularJS applications.  Protractor is a Node.js program built on top of WebDriverJS.  The framework allows us to run tests against our application in a real browser and mimic the interactions of a real user.  It supports Jasmine or Mocha for writing your tests, but I found that Jasmine’s test structure and syntax to be more fitting since it is a behavior-driven framework and we are testing user behavior.  Protractor is simple to setup and writing tests is fairly easy, especially if you have some prior experience with Jasmine or Mocha.  This should be the go-to E2E testing framework for all AngularJS projects.

To get started, please visit the Protractor tutorial.

 

protractor logo