End to End Testing With Protractor – Installation

Reading Time: 3 minutes

protractor end to end testing

End-to-End or E2E or UI testing is testing of applications from user’s perspective. It tests the user interface that is served to end user as an application output.

In Software Testing, one of the major drawbacks is to test the software constantly and notice regression. It becomes a very tedious job to check same functionality multiple times. Application development is a fast-paced process where development team delivers new features or changes extremely fast. This leaves little room for a complete manual regression testing for each iteration. Manual regression testing is a long and tedious process which is error prone.

End to End Testing – Why?

It is difficult to maintain large and complex applications through manual testing to verify the correctness of new features, catch bugs and checking regression for an individual tester or a testing team.

The main purpose of E2E Testing automates verification of the entire system after each iteration. There are possibilities of failure of entire integrated software system if any of its subsystems fails. E2E tests can be used to detect these type of issues before the application goes live.

End to End Testing – What?

As the name describes, it tests the application from one end to another end. The purpose of the end to end testing is to verify the quality of performance and flow of the application as per the requirement. 

E2E Testing can be described as a chain testing in one sentence, as it verifies integration between interconnected components of a software product.

Using Protractor:-

Protractor is officially known as the “End to End Testing” framework. It is an open source functional automation framework used to test Angular JS/Javascript web applications.

Protractor uses Jasmine test framework and it is a default framework that comes with the protractor. Few words about the Jasmine framework.

  • It is a behavior-driven development framework for testing JavaScript code. It is an independent framework having clean and obvious syntax. So, ultimately it helps any end user or non-technical person to write test cases with simple and understandable manner.
  • Jasmine framework is a loosely coupled framework that allows free – hand scripting. meaning you can write any arbitrary javascript and not just the angularjs.
How does it work?

Protractor works with Selenium. Selenium provides basic automated test infrastructure that is used to simulate user’s interaction with the angular application running in a browser.

Protractor will set up a test using a local standalone Selenium server that is used to control browsers. To run this server it requires Java Development Kit to be installed.

Protractor comes bundled with a very helpful utility called webdriver-manager. Webdriver-manager provides browser drivers for chrome, ie and firefox browsers. Jasmine tests interact via these drivers with browsers.

A test using protractor is divided in following three components:

  • Test Script – A test script is a set of instructions that is used to execute Webdriver API library in any of the user’s choice of language. These APIs are used to perform interactions between the selenium server & the scripts. 
  • Server – For the execution of the test script, it is required to run the Selenium server locally in a machine.
  • Browser – Test script communicates with a browser with the help of a browser driver. Ultimately the implementation of the test script depends on a browser that is extended with the browser driver. For example, the Chrome browser uses Chrome driver to run the test script.
Prerequisites & Installation

Prerequisites

  • Node.js (Latest Version)
    • Download NodeJS
    • Install NodeJs 
    • To test Node.Js installation properly open command prompt and execute any single command from the following
    • This should print version number of the node. So you will see something like v4.5.0 (i.e. latest installed version of node on your computer)

Installation

Install Protractor Globally   

  1. Open the command prompt and type following command to install protractor globally

    Verify Installation: – To verify installation type following command in command prompt once protractor is installed.

    On successful installation of a protractor, it displays latest installed version of the protractor on a command prompt as shown in below

    Here, you are done with your protractor installation! In the next part, we will see how to write a test script.


Also published on Medium.

Quality Analyst and Software Tester by profession.Highly Passionate for Testing and love to know everything that comes in testing.Motive is to deliver quality products with great perfection.Long term goal is to become successful project test manager.