SlideShare a Scribd company logo
Practical aspects of UI automation using
Cucumber and Capybara
by Alex Polovinko
3/14/2105
Automation frameworks
• What is all this about?
#Software with additional functionality: run: pass/fail
• From complexity to simplicity
#Abstraction is the point.
• Cucumber
# Simple, human collaboration: BDD that talks to
domain experts first and code second
# Cucumber lets software development teams describe
how software should behave in plain text. The text is
written in a business-readable domain-specific
language and serves as documentation, automated
tests and development-aid – all rolled into one format.
• Platforms and permutations
#https://cukes.info/platforms
Gherkin and Cucumber
architecture
1. Format for Cucumber Specifications.
#small computer language with a well-defined syntax
2. When you run Cucumber, it will generate a
report that verifies whether or not the software
behaves the way the Gherkin document says.
3. Gherkin DSL and units
#features/scenarios/steps
4. How that works?
5. Additional capabilities:
#flexible step definitions
#tables
#examples
#calling steps from steps
#I18N
Capybara
http://www.rubydoc.info/
github/jnicklas/capybara
#Capybara is a library (Gem) written in the Ruby programming
language which makes it easy to simulate how a user interacts with
your application
#Capybara is acting as an abstraction layer over the driver.
Agnostic about the driver running your tests and comes with
Selenium support built in
#Capybara also comes with a built in DSL for creating descriptive
acceptance tests (Intuitive API which mimics the language an
actual user would use):
Navigating/Clicking links and buttons/Interacting with
forms/Querying/Finding/Scoping/Working with
windows/Scripting/Modals/Debugging
https://gist.github.com/zhengjia/428105
http://www.rubydoc.info/github/jnicklas/capybara/master
#Drivers
Capybara uses the same DSL to drive a variety of browser and headless drivers.
Webdriver, native events.
Setup
+ RSpec to wrap it up
Challenges and Lessons learned
• Locators and browser specific Xpaths
• Iframes/windows
• Asynchronous JavaScript (Ajax and friends)
• Cross-site scripting prevention
• SSL alerts/modals handling
• FF profile settings
• Arbitrary JS (visibility of elements, mouse hover), JS engines
• Assertions (RSpec)/soft assertions handling
• State transitioning between steps/execution metadata
• Uniq scenarios and special chars in scenarios
Things you need to think of while developing scripts
o Good automation candidate:
#positive
#saving time
#robust
#false negatives
#cost of execution
o Critical/Smoke/Sanity/Regression
o Concept of orthogonal testing/coverage.
o Concept of tags: (wip, stories)
o Environmental variables, scalability, modularity
o Reusablity, common libraries. D(on’t)R(epeat)Y(ouself)
Platform/browsers/S
auceLabs
Before/after
hooks
Screenshots
Scenarios
metadata and
cli
Scripts enhancements
Dev:
While developing
feature /
autocommit
IDE integration
QA:
Functional
testing
debugging
reproducing
Sandbox:
UAT
Integration/Regression
Scheduling/batch files
Parallel/consequent
CI integration/Jenkins
rerun
Scripts execution in different environments
Reporting or How to make your manager be happy
Report
Pretty
JSON
Custom
formats
Plugins/Jenki
ngs
HTML
Looking Ahead
• Questions?
Appendix
http://cuke4ninja.com/
https://cukes.info/
https://github.com/jnicklas/capybara
http://testerstories.com/2014/08/learning-capybara-part-1/
http://www.sitepoint.com/basics-capybara-improving-tests/

More Related Content

PPTX
What new in Microsoft AI?
PPTX
Hands on BDD with cucumber - Agile Goa Sept 2013
PDF
Difference between vbscript and javascript
PPT
APIs And SDKs Breaking Into And Succeeding In A Specialty Market
PPTX
React Native - Why Designers should use React native. And everyone else too.
ODP
Learn Once; Write Anywhere
PPTX
DEVOPS LIVE 2018 JaC
PDF
SERVER SIDE SCRIPTING
What new in Microsoft AI?
Hands on BDD with cucumber - Agile Goa Sept 2013
Difference between vbscript and javascript
APIs And SDKs Breaking Into And Succeeding In A Specialty Market
React Native - Why Designers should use React native. And everyone else too.
Learn Once; Write Anywhere
DEVOPS LIVE 2018 JaC
SERVER SIDE SCRIPTING

What's hot (20)

DOCX
Inna Manni newest resume
PPTX
Client Side scripting and server side scripting
PDF
Firefox OS Weekend
PPTX
SGIN2013-ScrumStartRek-CucumberRecipes-SonikChopra
PPTX
Cucumber Tool
PPTX
Build a Great Conversationalist
PPTX
Mobile application development; Complete steps
PPTX
Vertical Slices in .NET - Bojan Veljanovski, March 2016, MK.NET UG
PDF
When to (use / not use) React Native.
PDF
2013-04-16 iOS development speed up
PPTX
Introduction to BOT Framework- Global Azure Bootcamp 2017
PPTX
Client side scripting and server side scripting
PPTX
Introduction to document db- Global Azure Bootcamp 2016
PPTX
Gluecon 2018 JaC
PPT
Cross platform mobile application development
PDF
Building hybrid apps with Xamarin, Ryan Paul
PPSX
Developing Downloadable Mobile Apps Using HTML5 and PhoneGap
PPTX
Building Native “apps” with Visual Studio 2015
PPTX
Angular JS - UI Development Online Training
KEY
Inna Manni newest resume
Client Side scripting and server side scripting
Firefox OS Weekend
SGIN2013-ScrumStartRek-CucumberRecipes-SonikChopra
Cucumber Tool
Build a Great Conversationalist
Mobile application development; Complete steps
Vertical Slices in .NET - Bojan Veljanovski, March 2016, MK.NET UG
When to (use / not use) React Native.
2013-04-16 iOS development speed up
Introduction to BOT Framework- Global Azure Bootcamp 2017
Client side scripting and server side scripting
Introduction to document db- Global Azure Bootcamp 2016
Gluecon 2018 JaC
Cross platform mobile application development
Building hybrid apps with Xamarin, Ryan Paul
Developing Downloadable Mobile Apps Using HTML5 and PhoneGap
Building Native “apps” with Visual Studio 2015
Angular JS - UI Development Online Training
Ad

Viewers also liked (11)

PDF
Ruby onrails cucumber-rspec-capybara
PDF
Rocket Fuelled Cucumbers
PPTX
Capybara + RSpec - ruby dsl-based web ui qa automation
PDF
Mobile automation using selenium cucumber & appium
PDF
Future of test automation tools & infrastructure
PPTX
Using Selenium and Cucumber to test a Healthcare Information System
PPTX
Cucumber
PDF
Mobile automation using selenium cucumber & appium
PPT
Cucumber - Curso de Automatización de Pruebas
PPTX
Automated Testing with Cucumber, PhantomJS and Selenium
PDF
Cucumber ppt
Ruby onrails cucumber-rspec-capybara
Rocket Fuelled Cucumbers
Capybara + RSpec - ruby dsl-based web ui qa automation
Mobile automation using selenium cucumber & appium
Future of test automation tools & infrastructure
Using Selenium and Cucumber to test a Healthcare Information System
Cucumber
Mobile automation using selenium cucumber & appium
Cucumber - Curso de Automatización de Pruebas
Automated Testing with Cucumber, PhantomJS and Selenium
Cucumber ppt
Ad

Similar to Cucumber_Capybara (20)

PPTX
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...
PPTX
Build Time Hacking
PDF
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
PDF
The Ring programming language version 1.6 book - Part 6 of 189
PPTX
Diploma 1st Year Project Internship Presentation.pptx
PDF
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
DOCX
Kunal bhatia resume mass
DOC
Chalam_JAVA_Portal
PDF
Embarcadero's Connected Development
PDF
Drupal 7 ci and testing
PPTX
Behavior driven development
PPTX
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
PDF
ABHAY_SHUKLA
PDF
Apache Cordova 4.x
PPT
SLC ASP.NET Framework and BPM (Eng)
DOCX
desktop_resume
PPTX
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...
PDF
Node.js BFFs - our way to the better/micro frontends
PDF
Dot NET Solution Architect Roadmap By Scholarhat PDF
PDF
Building scalable applications with angular js
Hyperion EPM APIs - Added value from HFM, Workspace, FDM, Smartview, and Shar...
Build Time Hacking
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
The Ring programming language version 1.6 book - Part 6 of 189
Diploma 1st Year Project Internship Presentation.pptx
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Kunal bhatia resume mass
Chalam_JAVA_Portal
Embarcadero's Connected Development
Drupal 7 ci and testing
Behavior driven development
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
ABHAY_SHUKLA
Apache Cordova 4.x
SLC ASP.NET Framework and BPM (Eng)
desktop_resume
An Open Source Workbench for Prototyping Multimodal Interactions Based on Off...
Node.js BFFs - our way to the better/micro frontends
Dot NET Solution Architect Roadmap By Scholarhat PDF
Building scalable applications with angular js

Cucumber_Capybara

  • 1. Practical aspects of UI automation using Cucumber and Capybara by Alex Polovinko 3/14/2105
  • 2. Automation frameworks • What is all this about? #Software with additional functionality: run: pass/fail • From complexity to simplicity #Abstraction is the point. • Cucumber # Simple, human collaboration: BDD that talks to domain experts first and code second # Cucumber lets software development teams describe how software should behave in plain text. The text is written in a business-readable domain-specific language and serves as documentation, automated tests and development-aid – all rolled into one format. • Platforms and permutations #https://cukes.info/platforms
  • 3. Gherkin and Cucumber architecture 1. Format for Cucumber Specifications. #small computer language with a well-defined syntax 2. When you run Cucumber, it will generate a report that verifies whether or not the software behaves the way the Gherkin document says. 3. Gherkin DSL and units #features/scenarios/steps 4. How that works? 5. Additional capabilities: #flexible step definitions #tables #examples #calling steps from steps #I18N
  • 4. Capybara http://www.rubydoc.info/ github/jnicklas/capybara #Capybara is a library (Gem) written in the Ruby programming language which makes it easy to simulate how a user interacts with your application #Capybara is acting as an abstraction layer over the driver. Agnostic about the driver running your tests and comes with Selenium support built in #Capybara also comes with a built in DSL for creating descriptive acceptance tests (Intuitive API which mimics the language an actual user would use): Navigating/Clicking links and buttons/Interacting with forms/Querying/Finding/Scoping/Working with windows/Scripting/Modals/Debugging https://gist.github.com/zhengjia/428105 http://www.rubydoc.info/github/jnicklas/capybara/master #Drivers Capybara uses the same DSL to drive a variety of browser and headless drivers. Webdriver, native events.
  • 5. Setup + RSpec to wrap it up
  • 6. Challenges and Lessons learned • Locators and browser specific Xpaths • Iframes/windows • Asynchronous JavaScript (Ajax and friends) • Cross-site scripting prevention • SSL alerts/modals handling • FF profile settings • Arbitrary JS (visibility of elements, mouse hover), JS engines • Assertions (RSpec)/soft assertions handling • State transitioning between steps/execution metadata • Uniq scenarios and special chars in scenarios
  • 7. Things you need to think of while developing scripts o Good automation candidate: #positive #saving time #robust #false negatives #cost of execution o Critical/Smoke/Sanity/Regression o Concept of orthogonal testing/coverage. o Concept of tags: (wip, stories) o Environmental variables, scalability, modularity o Reusablity, common libraries. D(on’t)R(epeat)Y(ouself)
  • 9. Dev: While developing feature / autocommit IDE integration QA: Functional testing debugging reproducing Sandbox: UAT Integration/Regression Scheduling/batch files Parallel/consequent CI integration/Jenkins rerun Scripts execution in different environments
  • 10. Reporting or How to make your manager be happy Report Pretty JSON Custom formats Plugins/Jenki ngs HTML

Editor's Notes

  • #2: This template can be used as a starter file to give updates for project milestones. Sections Right-click on a slide to add sections. Sections can help to organize your slides or facilitate collaboration between multiple authors. Notes Use the Notes section for delivery notes or to provide additional details for the audience. View these notes in Presentation View during your presentation. Keep in mind the font size (important for accessibility, visibility, videotaping, and online production) Coordinated colors Pay particular attention to the graphs, charts, and text boxes. Consider that attendees will print in black and white or grayscale. Run a test print to make sure your colors work when printed in pure black and white and grayscale. Graphics, tables, and graphs Keep it simple: If possible, use consistent, non-distracting styles and colors. Label all graphs and tables.
  • #3: What is the project about? Define the goal of this project Is it similar to projects in the past or is it a new effort? Define the scope of this project Is it an independent project or is it related to other projects? * Note that this slide is not necessary for weekly status meetings
  • #4: What is the project about? Define the goal of this project Is it similar to projects in the past or is it a new effort? Define the scope of this project Is it an independent project or is it related to other projects? * Note that this slide is not necessary for weekly status meetings
  • #5: What is the project about? Define the goal of this project Is it similar to projects in the past or is it a new effort? Define the scope of this project Is it an independent project or is it related to other projects? * Note that this slide is not necessary for weekly status meetings
  • #6: The following slides show several examples of timelines using SmartArt graphics. Include a timeline for the project, clearly marking milestones, important dates, and highlight where the project is now.
  • #7: Duplicate this slide as necessary if there is more than one issue. This and related slides can be moved to the appendix or hidden if necessary.
  • #8: * If any of these issues caused a schedule delay or need to be discussed further, include details in next slide.
  • #11: What are the dependencies that affect the timeline, cost, and output of this project?
  • #13: Prepare slides for the appendix in the event that more details or supplemental slides are needed. The appendix is also useful if the presentation is distributed later.