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.
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)
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.
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
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
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
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.
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.
* If any of these issues caused a schedule delay or need to be discussed further, include details in next slide.
What are the dependencies that affect the timeline, cost, and output of this project?
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.