SlideShare a Scribd company logo
Protractor Testing
Automation Tool Framework
Presented by Haitham Mahmoud
A Powerful JavaScript Framework
Introduction
Protractor plays an important role in the Testing of
AngularJS applications and works as a Solution
integrator combining powerful technologies like
Selenium
It is intended not only to test AngularJS application but
also for writing automated regression tests for normal
Web Applications as well.
What is AngularJS
AngularJS is a JavaScript-based open-source front-end
web application framework mainly maintained by
Google and by a community of individuals and
corporations to address many of the challenges
encountered in developing single-page applications.
Why Do We Need Protractor Framework?
JavaScript is used in almost all web applications. As the
applications grow, JavaScript also increases in size and
complexity. In such case, it becomes a difficult task for
Testers to test the web application for various scenarios.
Sometimes it is difficult to capture the web elements in
AngularJS applications using JUnit or Selenium WebDriver.
AngularJS application
AngularJS applications are Web Applications which uses
extended HTML's syntax to express web application
components. It is mainly used for dynamic web applications.
These applications use less and flexible code compared with
normal Web Applications.
Angular JS web elements using Normal
Selenium Web driver
Selenium is not able to identify those web elements using
Selenium code. So, Protractor on the top of Selenium can
handle and controls those attributes in Web Applications.
The protractor is an end to end testing framework
for Angular JS based applications. While most frameworks
focus on conducting unit tests for Angular JS applications,
Protractor focuses on testing the actual functionality of an
application.
Before we start Protractor
We need to install the following:
1. Selenium webdriver
2. NPM (Node.js)
How to install Node.js on Windows
2. NPM (Node.js)
1. NodeJS Installation, we need to install NodeJS to install Protractor.
1. Go to the site https://nodejs.org/en/download/ and download installer.
How to install Node.js on Windows
2. NPM (Node Package Manager) - (Node.js)
1. NodeJS Installation, we need to install NodeJS to install Protractor.
2. Double click on the downloaded .msi file to start the installation.
Click the Run button in the first screen
to begin the installation.
How to install Node.js on Windows
2. NPM (Node Package Manager) - (Node.js)
1. NodeJS Installation, we need to install NodeJS to install Protractor.
2. Double click on the downloaded .msi file to start the installation.
Click the Run button in the first screen
to begin the installation.
Running your first Hello world application
in Node.js
1. Create file Node.js with file name firstprogram.js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('Hello World!');
}).listen(8080);
Executing the code
2. Save the file on your computer: C:UsersYour Name firstprogram.js
Output
3. Start your internet browser, and type in the address:
http://localhost:8080
Protractor Installation
1. Open command prompt and type "npm install –g protractor" and hit
Enter. Then type “Protractor --version”
Protractor Installation
2. Update the Web driver manager >> The CMD was opening
Now type “webdriver-manager update”
The web driver manager is used for running the tests against the angular
web application in a specific browser. After Protractor is installed, the web
driver manager needs to be updated to the latest version. This can be
done by running the following command in the command prompt.
Protractor Installation
2. Update the Web driver manager
Protractor Installation
3. Start the web driver manager >> The CMD was opening
Now type “webdriver-manager start”
This step will run the web driver manager in the background and will listen
to any tests which run via protractor.
Protractor Installation
4. Now, if you go to the following URL
(http://localhost:4444/wd/hub/static/resource/hub.html)
in your browser, you will actually see the Web driver manager running
in the background.
Let’s Go to test
Sample AngularJS application testing using
Protractor
Protractor needs two files to run, a spec file and configuration file.
1. Configuration file: This File helps protractor to where the test files
are placed (specs.js) and to talk with Selenium server (Selenium
Address). Chrome is the default browser for Protractor.
2. Spec file: This File contains the logic and locators to interact with
the application.
Let’s Go to test
Sample AngularJS application testing using
Protractor
1. We have to login https://angularjs.org
2. Enter the text as “Haitham“
3. Now we have to capture the text from the webpage after entering
the name and need to verify with the expected text.
Let’s Go to test
Sample AngularJS application testing using
Protractor
We have to prepare configuration file (conf.js) and spec file (spec.js) as
mentioned above.
Now we will create (spec.js)
describe('Enter Haitham Name', function() {
it('should add a Name as Haitham', function() {
browser.get('https://angularjs.org');
element(by.model('yourName')).sendKeys('Haitham');
var myName= element(by.xpath("//input[@class='ng-valid ng-dirty ng-valid-parse ng-touched ng-empty"]'));
expect(myName.getText()).toEqual('Hello Haitham!');
});
});
Let’s Go to test
Sample AngularJS application testing using
Protractor
We have to prepare configuration file (conf.js) and spec file (spec.js) as
mentioned above.
Now we will create (conf.js)
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
};
Let’s Go to test
Sample AngularJS application testing using
Protractor
• Execution of the Code
1. Open the command prompt.
2. Make sure selenium web driver manager is up and running. For that
give the command as "webdriver-manager start" and hit Enter.
3. Open a new command prompt and give the command as "protractor
conf.js" to run the configuration file.
Let’s Go to test
Sample AngularJS application testing using
Protractor
Let’s Go to test
Sample AngularJS application testing using
Protractor
Generate Reports using Jasmine
Reporters
Protractor supports Jasmine reporters to generate test reports. In this
section, we will use JunitXMLReporter to generate Test execution
reports automatically in XML format.
Installation of Jasmine Reporter
There are two way you can do this, locally or globally
1. Open command prompt execute the following command to install
locally
Above command will install jasmine reports node-modules locally
means from the directory where we are running the command in
command prompt.
npm install --save-dev jasmine-reporters@^2.0.0
Installation of Jasmine Reporter
Ignore this command
There are two way you can do this, locally or globally
2. Open command prompt execute the following command for global
installation
Above command will install jasmine reports node-modules locally
means from the directory where we are running the command in
command prompt.
npm install –g jasmine-reporters@^2.0.0
Install the jasmine reporters locally
1. Execute the command.
npm install --save-dev jasmine-reporters@^2.0.0
Installation of Jasmine Reporter
There are two way you can do this, locally or globally
1. Open command prompt execute the following command to install
locally
Install the jasmine reporters locally
2. Check the installation folders in the directory.
" Node_modules" should be available if it is successfully installed like in
below snapshot.
Install the jasmine reporters locally
3. Add the following colored code to an existed conf.js file
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'firefox'
},
specs: ['spec.js'],
framework: 'jasmine2' ,
onPrepare: function() {
var jasmineReporters = require('C:/Users/RE041943/Desktop/guru/node_modules/jasmine-
reporters');
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter(null, true, true)
);
}
};
Install the jasmine reporters locally
4. In code, we are generating the report "JUnitXmlReporter" and giving
the Path where to store the report.

More Related Content

PPTX
Protractor overview
PPTX
Presentation_Protractor
PDF
Introduction to Protractor
PDF
Selenium Maven With Eclipse | Edureka
PPTX
Automation - web testing with selenium
PPTX
Load Runner
PDF
Test Automation Framework Design | www.idexcel.com
PDF
Cypress Automation Testing Tutorial (Part 1).pdf
Protractor overview
Presentation_Protractor
Introduction to Protractor
Selenium Maven With Eclipse | Edureka
Automation - web testing with selenium
Load Runner
Test Automation Framework Design | www.idexcel.com
Cypress Automation Testing Tutorial (Part 1).pdf

What's hot (20)

PPT
Test automation using selenium
PPTX
Automation Testing
PPTX
Selenium WebDriver training
PDF
WebLogic FAQs
PPTX
Hybrid automation framework
PDF
Cross Browser Testing Using LambdaTest | Edureka
PPTX
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
PPTX
Load Testing and JMeter Presentation
PPT
Test Automation Framework Designs
PPTX
Telerik Test studio
PDF
INTRODUCTION TO ISTQB FOUNDATION LEVEL - CTFL
ODP
Why Katalon Studio?
PPTX
Test Automation and Selenium
PPTX
Katalon Studio Presentation.pptx
PPS
JUnit Presentation
PPT
Hybrid Automation Framework Development introduction
PPTX
Test automation using selenium
PDF
UNIT 5-JavaFX Event Handling, Controls and Components.pdf
PDF
Spring annotation
PPTX
Spring boot
Test automation using selenium
Automation Testing
Selenium WebDriver training
WebLogic FAQs
Hybrid automation framework
Cross Browser Testing Using LambdaTest | Edureka
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Load Testing and JMeter Presentation
Test Automation Framework Designs
Telerik Test studio
INTRODUCTION TO ISTQB FOUNDATION LEVEL - CTFL
Why Katalon Studio?
Test Automation and Selenium
Katalon Studio Presentation.pptx
JUnit Presentation
Hybrid Automation Framework Development introduction
Test automation using selenium
UNIT 5-JavaFX Event Handling, Controls and Components.pdf
Spring annotation
Spring boot
Ad

Similar to Protractor Testing Automation Tool Framework / Jasmine Reporters (20)

PDF
Moving from selenium to protractor for test automation
PPTX
Protractor framework architecture with example
PPTX
Protractor Tutorial Quality in Agile 2015
PPTX
Protractor End To End Testing For AngularJS
PPTX
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...
PPTX
ProtractorJS for automated testing of Angular 1.x/2.x applications
PPTX
Introduction to Protractor - Habilelabs
PPTX
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
PPTX
Angular js automation using protractor
PDF
Workshop - E2e tests with protractor
PPTX
Selenium with protractor
PPTX
An Introduction to AngularJS End to End Testing using Protractor
DOCX
Protractor end-to-end testing framework for angular js
PPTX
Protractor framework – how to make stable e2e tests for Angular applications
PDF
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
PPTX
Protractor training
PPTX
Angular UI Testing with Protractor
PDF
AngularJS and Protractor
PPTX
Protractor survival guide
PPTX
Protractor
Moving from selenium to protractor for test automation
Protractor framework architecture with example
Protractor Tutorial Quality in Agile 2015
Protractor End To End Testing For AngularJS
QA Fes 2016. Александр Хотемской. Обзор ProtractorJS как фреймворка для брауз...
ProtractorJS for automated testing of Angular 1.x/2.x applications
Introduction to Protractor - Habilelabs
Олександр Хотемський “ProtractorJS як інструмент браузерної автоматизації для...
Angular js automation using protractor
Workshop - E2e tests with protractor
Selenium with protractor
An Introduction to AngularJS End to End Testing using Protractor
Protractor end-to-end testing framework for angular js
Protractor framework – how to make stable e2e tests for Angular applications
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Protractor training
Angular UI Testing with Protractor
AngularJS and Protractor
Protractor survival guide
Protractor
Ad

Recently uploaded (20)

PDF
top salesforce developer skills in 2025.pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
medical staffing services at VALiNTRY
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
System and Network Administraation Chapter 3
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Understanding Forklifts - TECH EHS Solution
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPT
Introduction Database Management System for Course Database
PPTX
L1 - Introduction to python Backend.pptx
top salesforce developer skills in 2025.pdf
Softaken Excel to vCard Converter Software.pdf
How Creative Agencies Leverage Project Management Software.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
medical staffing services at VALiNTRY
Which alternative to Crystal Reports is best for small or large businesses.pdf
System and Network Administraation Chapter 3
ISO 45001 Occupational Health and Safety Management System
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Design an Analysis of Algorithms I-SECS-1021-03
How to Choose the Right IT Partner for Your Business in Malaysia
Understanding Forklifts - TECH EHS Solution
How to Migrate SBCGlobal Email to Yahoo Easily
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
2025 Textile ERP Trends: SAP, Odoo & Oracle
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Introduction Database Management System for Course Database
L1 - Introduction to python Backend.pptx

Protractor Testing Automation Tool Framework / Jasmine Reporters

  • 1. Protractor Testing Automation Tool Framework Presented by Haitham Mahmoud
  • 3. Introduction Protractor plays an important role in the Testing of AngularJS applications and works as a Solution integrator combining powerful technologies like Selenium It is intended not only to test AngularJS application but also for writing automated regression tests for normal Web Applications as well.
  • 4. What is AngularJS AngularJS is a JavaScript-based open-source front-end web application framework mainly maintained by Google and by a community of individuals and corporations to address many of the challenges encountered in developing single-page applications.
  • 5. Why Do We Need Protractor Framework? JavaScript is used in almost all web applications. As the applications grow, JavaScript also increases in size and complexity. In such case, it becomes a difficult task for Testers to test the web application for various scenarios. Sometimes it is difficult to capture the web elements in AngularJS applications using JUnit or Selenium WebDriver.
  • 6. AngularJS application AngularJS applications are Web Applications which uses extended HTML's syntax to express web application components. It is mainly used for dynamic web applications. These applications use less and flexible code compared with normal Web Applications.
  • 7. Angular JS web elements using Normal Selenium Web driver Selenium is not able to identify those web elements using Selenium code. So, Protractor on the top of Selenium can handle and controls those attributes in Web Applications. The protractor is an end to end testing framework for Angular JS based applications. While most frameworks focus on conducting unit tests for Angular JS applications, Protractor focuses on testing the actual functionality of an application.
  • 8. Before we start Protractor We need to install the following: 1. Selenium webdriver 2. NPM (Node.js)
  • 9. How to install Node.js on Windows 2. NPM (Node.js) 1. NodeJS Installation, we need to install NodeJS to install Protractor. 1. Go to the site https://nodejs.org/en/download/ and download installer.
  • 10. How to install Node.js on Windows 2. NPM (Node Package Manager) - (Node.js) 1. NodeJS Installation, we need to install NodeJS to install Protractor. 2. Double click on the downloaded .msi file to start the installation. Click the Run button in the first screen to begin the installation.
  • 11. How to install Node.js on Windows 2. NPM (Node Package Manager) - (Node.js) 1. NodeJS Installation, we need to install NodeJS to install Protractor. 2. Double click on the downloaded .msi file to start the installation. Click the Run button in the first screen to begin the installation.
  • 12. Running your first Hello world application in Node.js 1. Create file Node.js with file name firstprogram.js var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.end('Hello World!'); }).listen(8080);
  • 13. Executing the code 2. Save the file on your computer: C:UsersYour Name firstprogram.js
  • 14. Output 3. Start your internet browser, and type in the address: http://localhost:8080
  • 15. Protractor Installation 1. Open command prompt and type "npm install –g protractor" and hit Enter. Then type “Protractor --version”
  • 16. Protractor Installation 2. Update the Web driver manager >> The CMD was opening Now type “webdriver-manager update” The web driver manager is used for running the tests against the angular web application in a specific browser. After Protractor is installed, the web driver manager needs to be updated to the latest version. This can be done by running the following command in the command prompt.
  • 17. Protractor Installation 2. Update the Web driver manager
  • 18. Protractor Installation 3. Start the web driver manager >> The CMD was opening Now type “webdriver-manager start” This step will run the web driver manager in the background and will listen to any tests which run via protractor.
  • 19. Protractor Installation 4. Now, if you go to the following URL (http://localhost:4444/wd/hub/static/resource/hub.html) in your browser, you will actually see the Web driver manager running in the background.
  • 20. Let’s Go to test Sample AngularJS application testing using Protractor Protractor needs two files to run, a spec file and configuration file. 1. Configuration file: This File helps protractor to where the test files are placed (specs.js) and to talk with Selenium server (Selenium Address). Chrome is the default browser for Protractor. 2. Spec file: This File contains the logic and locators to interact with the application.
  • 21. Let’s Go to test Sample AngularJS application testing using Protractor 1. We have to login https://angularjs.org 2. Enter the text as “Haitham“ 3. Now we have to capture the text from the webpage after entering the name and need to verify with the expected text.
  • 22. Let’s Go to test Sample AngularJS application testing using Protractor We have to prepare configuration file (conf.js) and spec file (spec.js) as mentioned above. Now we will create (spec.js) describe('Enter Haitham Name', function() { it('should add a Name as Haitham', function() { browser.get('https://angularjs.org'); element(by.model('yourName')).sendKeys('Haitham'); var myName= element(by.xpath("//input[@class='ng-valid ng-dirty ng-valid-parse ng-touched ng-empty"]')); expect(myName.getText()).toEqual('Hello Haitham!'); }); });
  • 23. Let’s Go to test Sample AngularJS application testing using Protractor We have to prepare configuration file (conf.js) and spec file (spec.js) as mentioned above. Now we will create (conf.js) exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['spec.js'] };
  • 24. Let’s Go to test Sample AngularJS application testing using Protractor • Execution of the Code 1. Open the command prompt. 2. Make sure selenium web driver manager is up and running. For that give the command as "webdriver-manager start" and hit Enter. 3. Open a new command prompt and give the command as "protractor conf.js" to run the configuration file.
  • 25. Let’s Go to test Sample AngularJS application testing using Protractor
  • 26. Let’s Go to test Sample AngularJS application testing using Protractor
  • 27. Generate Reports using Jasmine Reporters Protractor supports Jasmine reporters to generate test reports. In this section, we will use JunitXMLReporter to generate Test execution reports automatically in XML format.
  • 28. Installation of Jasmine Reporter There are two way you can do this, locally or globally 1. Open command prompt execute the following command to install locally Above command will install jasmine reports node-modules locally means from the directory where we are running the command in command prompt. npm install --save-dev jasmine-reporters@^2.0.0
  • 29. Installation of Jasmine Reporter Ignore this command There are two way you can do this, locally or globally 2. Open command prompt execute the following command for global installation Above command will install jasmine reports node-modules locally means from the directory where we are running the command in command prompt. npm install –g jasmine-reporters@^2.0.0
  • 30. Install the jasmine reporters locally 1. Execute the command. npm install --save-dev jasmine-reporters@^2.0.0
  • 31. Installation of Jasmine Reporter There are two way you can do this, locally or globally 1. Open command prompt execute the following command to install locally
  • 32. Install the jasmine reporters locally 2. Check the installation folders in the directory. " Node_modules" should be available if it is successfully installed like in below snapshot.
  • 33. Install the jasmine reporters locally 3. Add the following colored code to an existed conf.js file exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: { 'browserName': 'firefox' }, specs: ['spec.js'], framework: 'jasmine2' , onPrepare: function() { var jasmineReporters = require('C:/Users/RE041943/Desktop/guru/node_modules/jasmine- reporters'); jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter(null, true, true) ); } };
  • 34. Install the jasmine reporters locally 4. In code, we are generating the report "JUnitXmlReporter" and giving the Path where to store the report.

Editor's Notes

  • #13: Code Explanation: The basic functionality of the "require" function is that it reads a JavaScript file, executes the file, and then proceeds to return an object. Using this object, one can then use the various functionalities available in the module called by the require function. So in our case, since we want to use the functionality of http and we are using the require(http) command. In this 2nd line of code, we are creating a server application which is based on a simple function. This function is called, whenever a request is made to our server application. When a request is received, we are asking our function to return a "Hello World" response to the client. The writeHead function is used to send header data to the client and while the end function will close the connection to the client. We are then using the server.listen function to make our server application listen to client requests on port no 7000. You can specify any available port over here.
  • #23: describe('Enter Haitham Name', function()The describe syntax is from the Jasmine framework. Here "describe" ('Enter Haitham Name') typically defines components of an application, which can be a class or function etc. In the code suite called as "Enter Haitham ," it's just a string and not a code. it('should add a Name as Haitham ', function() browser.get('https://angularjs.org')As like in Selenium Webdriver browser.get will open a new browser instance with mentioned URL. element(by.model('yourName')).sendKeys(Haitham ')Here we are finding the web element using the Model name as "yourName," which is the value of "ng-model" on the web page. var myName = element(by.xpath(('//input[@class=“ng-valid ng-dirty ng-valid-parse ng-touched ng-empty”]'))Here we are finding the web element using XPath and store its value in a variable “myName". expect(guru.getText()).toEqual('Hello Haitham!')Finally we are verifying the text which we have got from the webpage (using gettext() ) with expected text .
  • #24: seleniumAddress: 'http://localhost:4444/wd/hub'The Configuration file tells Protractor the location of Selenium Address to talk with Selenium WebDriver. specs: ['spec.js']This line tells Protractor the location of test files spec.js
  • #25: seleniumAddress: 'http://localhost:4444/wd/hub'The Configuration file tells Protractor the location of Selenium Address to talk with Selenium WebDriver. specs: ['spec.js']This line tells Protractor the location of test files spec.js
  • #30: seleniumAddress: 'http://localhost:4444/wd/hub'The Configuration file tells Protractor the location of Selenium Address to talk with Selenium WebDriver. specs: ['spec.js']This line tells Protractor the location of test files spec.js