The presentation on Protractor Cucumber BDD Approach was done during #ATAGTR2017, one of the largest global testing conference. All copyright belongs to the author.
Author and presenter : Rajat Acharya
5. Agile Testing Alliance Global Testing Retreat 2017
Protractor and BDD
Protractor is an open source, end to end testing framework designed
specifically for AngularJS web applications.
Protractor it is a solution integrator - combining powerful BDD frameworks
such as …
6. Agile Testing Alliance Global Testing Retreat 2017
How we will do it…
1 2 3 4 5 6
Create Automation
Suite with Protractor,
Cucumber and Gulp.
Create feature files from:
User Stories / Use Cases
Defect Steps
Test Cases/Scenarios
Run the feature files and
create stubs [A stub is a
small program that
substitutes for a longer
program]
Create the executable
code with Protractor and
attach it to the feature
statements
Once the code is attached
to the feature
statements, we can
execute the same code
for same repeating
feature statements
We can select the features
that we want to execute
[existing applications+ Past
defects] and easily create
different runner files on
need basis and execute
the automation suite
7. Agile Testing Alliance Global Testing Retreat 2017
Approach for Protractor Cucumber
IDEA Define
FEATURE FILES
(.features)
STEP DEFINITION
(.js)
User Stories / Use Cases
PAGE OBJECT
(.js)
Static
TEST DATA
UTILITY FUNCTIONS
(.js)
CORE FUNCTIONS
(.js)
Dynamic
TEST DATA -
Json
ATOM EDITOR/ NOTEPAD-PLUS
Runner
(.js)
QA team/Disney team
Acceptance/
Report
Web driverJs
Application under test
9. Agile Testing Alliance Global Testing Retreat 2017
Advantages of using Protractor and
Cucumber
Feature statement written multiple times, will have a single
corresponding code attached.
Write script once and Run on need basis.
Records time to execute hence also tells us if performance has
improved/degraded from previous run results.
Test results history with compare functionality.
Can be auto triggered when Developers are using Code build in
Jenkins.
Freeware hence saving project Budget.
Automation scripts can be reused.
10. Agile Testing Alliance Global Testing Retreat 2017
Learning Outcomes
Audience will be aware of protractor cucumber end to end
automation testing frameworks.
Automation testing framework for AngularJs Applications.
Easy and reliable object identification for AngularJs Application.
Scripts are faster in execution.
11. Agile Testing Alliance Global Testing Retreat 2017
Best Practices
Set screen size so that all the elements are visible.
Page objects should be used to map the elements and write the functions
to perform actions.
Simple, Clean and tidy folder structure. Exports and require should be used
to connect your specs and page objects.
SVN/GitHub can be used as a version control.
AngularJS (commonly referred to as "Angular" or "Angular.js") is a complete JavaScript-based open-source front-end web application mainly maintained by Google to address many of the challenges encountered in developing single-page applications.
AngularJS is a JavaScript framework. It can be added to an HTML page with a <script> tag.
AngularJS extends HTML attributes with Directives, and binds data to HTML with Expressions
Protractor is an end-to-end test framework for Angular and AngularJS applications. It acts as an abstraction layer to make automation write and execute easily for Angular.js application.
Angular JS applications have some extra HTML attributes like ng-repeater, ng-controller, ng-model.., etc. which are not included in Selenium locators. 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.
Jasmine is a behavior-driven development framework for testing JavaScript code. It is default framework that comes with Protractor. Cucumber is for Behaviour-Driven Development and uses gherkin . Mocha is a JavaScript test framework running on node.js, featuring browser support, asynchronous testing, test coverage reports, and use of any assertion library.