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

What's hot

Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
Khaja Moiz Uddin
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
Cynoteck Technology Solutions Private Limited
 
Selenium IDE
Selenium IDESelenium IDE
Selenium IDE
b4usolution .
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with Selenium
Kerry Buckley
 
Selenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaSelenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | Edureka
Edureka!
 
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Simplilearn
 
Why Should we use Microsoft's Playwright
Why Should we use Microsoft's PlaywrightWhy Should we use Microsoft's Playwright
Why Should we use Microsoft's Playwright
Knoldus Inc.
 
Selenium-4
Selenium-4Selenium-4
Selenium-4
Manoj Kumar Kumar
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
Tzirla Rozental
 
Flutter frame work
Flutter frame workFlutter frame work
Flutter frame work
samash
 
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Edureka!
 
A guide to getting started with WebdriverIO
A guide to getting started with WebdriverIOA guide to getting started with WebdriverIO
A guide to getting started with WebdriverIO
Nilenth Selvaraja
 
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
Edureka!
 
Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)
Priyanka Tyagi
 
A flight with Flutter
A flight with FlutterA flight with Flutter
A flight with Flutter
Ahmed Tarek
 
Front end development session1
Front end development session1Front end development session1
Front end development session1
marwa Ayad Mohamed
 
Selenium introduction
Selenium introductionSelenium introduction
Selenium introduction
Pankaj Dubey
 
Jenkins presentation
Jenkins presentationJenkins presentation
Jenkins presentation
Valentin Buryakov
 
Test Automation and Selenium
Test Automation and SeleniumTest Automation and Selenium
Test Automation and Selenium
Karapet Sarkisyan
 

What's hot (20)

Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Selenium IDE
Selenium IDESelenium IDE
Selenium IDE
 
Web application testing with Selenium
Web application testing with SeleniumWeb application testing with Selenium
Web application testing with Selenium
 
Selenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | EdurekaSelenium Maven With Eclipse | Edureka
Selenium Maven With Eclipse | Edureka
 
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
 
Why Should we use Microsoft's Playwright
Why Should we use Microsoft's PlaywrightWhy Should we use Microsoft's Playwright
Why Should we use Microsoft's Playwright
 
Selenium-4
Selenium-4Selenium-4
Selenium-4
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Flutter frame work
Flutter frame workFlutter frame work
Flutter frame work
 
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
 
test_automation_POC
test_automation_POCtest_automation_POC
test_automation_POC
 
A guide to getting started with WebdriverIO
A guide to getting started with WebdriverIOA guide to getting started with WebdriverIO
A guide to getting started with WebdriverIO
 
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
 
Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)Developing Cross platform apps in flutter (Android, iOS, Web)
Developing Cross platform apps in flutter (Android, iOS, Web)
 
A flight with Flutter
A flight with FlutterA flight with Flutter
A flight with Flutter
 
Front end development session1
Front end development session1Front end development session1
Front end development session1
 
Selenium introduction
Selenium introductionSelenium introduction
Selenium introduction
 
Jenkins presentation
Jenkins presentationJenkins presentation
Jenkins presentation
 
Test Automation and Selenium
Test Automation and SeleniumTest Automation and Selenium
Test Automation and Selenium
 

Similar to Protractor Testing Automation Tool Framework / Jasmine Reporters

AngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue SolutionsAngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue Solutions
RapidValue
 
Presentation_Protractor
Presentation_ProtractorPresentation_Protractor
Presentation_ProtractorUmesh Randhe
 
Selenium for Tester.pdf
Selenium for Tester.pdfSelenium for Tester.pdf
Selenium for Tester.pdf
RTechRInfoIT
 
Front end workflow with yeoman
Front end workflow with yeomanFront end workflow with yeoman
Front end workflow with yeoman
hassan hafez
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
Mbakaya Kwatukha
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with Appium
Luke Maung
 
An Overview of Angular 4
An Overview of Angular 4 An Overview of Angular 4
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
Pratik Patel
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With Selenium
Marakana Inc.
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
Pandiya Rajan
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
chrisb206 chrisb206
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
shadabgilani
 
Node JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applicationsNode JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applications
Expeed Software
 
Using galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingUsing galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testing
Sarah Elson
 
Qa process
Qa processQa process
Qa process
Aila Bogasieru
 
Steps to write Selenium
Steps to write Selenium  Steps to write Selenium
Steps to write Selenium Rohit Thakur
 
Qa process
Qa processQa process
Qa process
Aila Bogasieru
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using RubyKumari Warsha Goel
 

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

AngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue SolutionsAngularJS Project Setup step-by- step guide - RapidValue Solutions
AngularJS Project Setup step-by- step guide - RapidValue Solutions
 
Presentation_Protractor
Presentation_ProtractorPresentation_Protractor
Presentation_Protractor
 
Selenium for Tester.pdf
Selenium for Tester.pdfSelenium for Tester.pdf
Selenium for Tester.pdf
 
Front end workflow with yeoman
Front end workflow with yeomanFront end workflow with yeoman
Front end workflow with yeoman
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with Appium
 
An Overview of Angular 4
An Overview of Angular 4 An Overview of Angular 4
An Overview of Angular 4
 
Getting started with appium
Getting started with appiumGetting started with appium
Getting started with appium
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With Selenium
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
 
Selenium
SeleniumSelenium
Selenium
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
 
Node JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applicationsNode JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applications
 
Exploring Maven SVN GIT
Exploring Maven SVN GITExploring Maven SVN GIT
Exploring Maven SVN GIT
 
Using galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingUsing galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testing
 
Qa process
Qa processQa process
Qa process
 
Steps to write Selenium
Steps to write Selenium  Steps to write Selenium
Steps to write Selenium
 
Qa process
Qa processQa process
Qa process
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
 

Recently uploaded

Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
mz5nrf0n
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
kalichargn70th171
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 

Recently uploaded (20)

Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 

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

  1. 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.
  2. 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 .
  3. 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
  4. 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
  5. 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