A brief introduction about Protractor

Before start with Protractor for AngularJS Application, you will need to understand little about AngularJS itself.

Why we use AngularJS?

AngularJS is the most popular JavaScript based front-end framework mainly maintained by Google. It is a full featured framework for developing web application from the scrape and the basic goal is to simplify development and testing processes. It also makes it easier for developers to keep their web project organized and avoid repeating code.

In simple word we can define AngularJS as a Cross-platform framework. It is fast and it provides great support for unit testing tools.

AngularJS based applications can be automated using Selenium but using Java Selenium you may face some issues like:

=         Synchronization Issues

=         Dynamic Locator

=         Dynamic Loading

Protractor is a Node.js program and built on top of WebDriverJS. Protractor has capabilities to handle dynamic loading.

So what is Protractor?

Protractor is an end-to-end testing framework that are written in JavaScript and run with NodeJS. It works as a solution integrator which means it combining powerful tools and technologies like Selenium, WebDriver, Jasmine, NodeJS and Mocha.

Protractor was purposely created for testing AngularJS applications, which allows you to test angular-specific elements without any extra efforts.

Why Protractor?

AngularJs applications have some extra HTML attributes like ng-controller, ng-model, ng-repeat and ng-view etc which are not identified by Selenium code. So with the help of Protractor we can handle these web application attributes. In protractor additional locator strategies are used like

=         waitForAngular

=         by.model

=         by.repeater

=         by.exactRepeater

=         by.binding

=         by.buttontext

And Inherited from WebDriver.By

How does the Protractor Work?

1.       Jasmine used to create Test Script.

2.       Protractor used to Execute Test Execution.

3.       Selenium Server used to manage browsers.

4.       Selenium WebDriver used to invoke browsers APIs.

Feature of Protractor

=         Huge benefit of using Protractor is automatic wait, which means you will not have to implement explicit wait or sleep to test your application. Protractor knows when an AngularJs application loading is done. 

=         Protractor test case Execution speed is high which automatically decreases execution time.

=         It supports all features of selenium web driver and extending itself to support for AngularJS.

=         It can be used for Angular and Non-Angular applications.

=         Its Installation is quite straight forward.

=         Protractor also supporting for Mobile applications.

=         Execution runs on both real and headless Browsers.

=         Easily readable jasmine framework.

=         Support Data Driven Test

Drawbacks of Protractor

=         Debugging is very tricky.

=         Recording is not possible in this.

=         Less support is available. (Online open source community)

 

  Niharika, has an overall 6 years of experience in software testing. She has worked on varied applications like Desktop application, E-Commerce Web Application, Mobile Application and Casino games. An  ISTQB Certified Tester, she currently resides at  San Fransisco Bay Area, USA.  

About Author