SlideShare a Scribd company logo
1 of 31
Download to read offline
End-to-end web-testing based on
ruby/cucumber/watir/watirsome tech
Alex Mikitenko
Alex Mikitenko, Ukraine
Lead QA Automation, Tech Team Labs
• 10 years in the IT as a developer in test
• Ruby fan
• Anarchist
https://www.linkedin.com/in/omykytenko/
https://www.slideshare.net/korvinua
https://github.com/nonkor
https://www.visualcv.com/alex-mikitenko
[ description ]
A classic task for an automation QA engineer these days:
Developer and automate test coverage for some web or mobile
software solution.
This workshop offers a quick start for anyone who is interested to build a
proper end-to-end test framework for those needs from the scratch.
We will use robust and effective stack of technologies, verified by time and
trusted by community:
RUBY + CUCUMBER + WATIR + WATIRSOME + RSPEC/EXPECTATIONS
Ready? Let’s start then!
[ e2e-testing ]
So, what is end-to-end testing?
End-to-end testing is a methodology used to test whether the flow of an
application is performing as designed from start to finish. The purpose of
carrying out end-to-end tests is to identify system dependencies and to
ensure that the right information is passed between various system
components and systems.
(via) techopedia.com
[ testing pyramid ]
(via) watirmelon.com
[ ruby ]
Why Ruby?
- open source;
- huge ecosystem;
- human oriented standards;
- truly OOP language;
- powerful metaprogramming facilities;
- DSL-oriented;
- easy to learn (hardcode level included, but you need go deep to met it);
- has trusted and robust tech stack for GUI web-automation;
- I use it on a daily basis :)
[ ruby ]
Manage Ruby by rbenv
# install rbenv
$ brew update
$ brew install rbenv
$ rbenv init
$ 'eval "$(rbenv init -)"' >> ~/.bash_profile
# install ruby-build
$ rbenv install -l
# install ruby
$ rbenv install 2.4.1
rbenv is lightweight Ruby version management tool
[ ruby gems ]
Manage Ruby gems by bundler
bundler provides a consistent environment for Ruby projects by tracking
and installing the exact gems and versions that are needed.
# create project and go to it
$ mkdir gui-test-sample
$ cd gui-test-sample
# install bundler
$ gem install bundler
$ bundle init
# install gems
$ ‘gem “cucumber”' >> ~/.bash_profile
$ bundle install
[ cucumber ]
Why Cucumber?
it’s collaboration tool allows you to run automated
acceptance tests written in a BDD style
- illustrates business rules, not just UI;
- scenario writing does not require knowledge of
specific programming language;
- gives a possibility to write Cucumber scenarios
before writing the code.
Your cucumber features should drive your implementation, not reflect it.
Andrew Premdas, one of the first adopters of Cucumber
[ cucumber ]
Initiate cucumber
$ bundle exec cucumber --init
features
steps
support
storage of test scenarios
storage of test step definitions
storage of cucumber env files and hooks preloaded for every test run
[ website sample ]
[ declarative vs. imperative ]
is a programming
paradigm that expresses
the logic of a
computation (what do)
without describing its
control flow (how do).
Declarative
programming
Imperative
programming
is a programming
paradigm that describes
computation in terms of
statements that change a
program state.
[ cucumber features ] Imperative style
[ cucumber features ] Declarative style
[ initiate project ]
env.rb
hooks.rb
[ initiate project ]
helper.rb
settings.yml
[ cucumber features ]
First run
$ bundle exec cucumber features/
sample_shopping_declarative.feature
Using the default profile...
Feature: Sample shopping [declarative]
Scenario: Order a blue t-shirt
…
1 scenario (1 undefined)
19 steps (19 undefined)
0m0.112s
[ cucumber features ]
Pending scenarios
You can implement step definitions for undefined steps with these snippets:
Given(/^I have a valid user account$/) do
pending # Write code here that turns the phrase above into concrete actions
end
…
[ watir ]
Why Watir?
- open source;
- web application testing in ruby;
- interacts with a browser the same way people do;
- is not a record/playback tool;
- has a clear and consistent API;
- based on WebDriver (which is W3C Web Standard);
- many of watir contributors are webdriver contributors, too;
- used as a foundation for cross browser cloud services as saucelabs.com;
- has page-object pattern extensions.
[ watir ]
Watir sample
[ watir ]
plane_steps.rb
[ watir ]
Why Page Objects?
- Page Object pattern represents the screens of your web app as a
series of objects and encapsulates the features represented by a
page;
- it allows us to model the UI in our tests;
- a page object is an object-oriented class that serves as an
interface to a page of your AUT.
[ watir ]
Page Object Model
webdriver
[ watirsome ]
Watirsome sample
[ watirsome ]
tshirts_page.rb
[ watirsome ]
page_steps.rb
[ rspec/expectations ]
rspec/expectations
provides a simple, readable API to express expected outcomes of a code example
expect(actual).to eq(expected)
expect(actual).to eql(expected)
expect(actual).not_to eql(not_expected)
expect(actual).to be > expected
expect(actual).to be < expected
expect(actual).to be_within(delta).of(expected)
expect(actual).to match(/expression/)
expect(actual).to be_an_instance_of(expected)
expect(actual).to be_a(expected)
expect(actual).to be_an(expected)
expect(actual).to be_a_kind_of(expected)
expect { ... }.to raise_error
expect { ... }.to raise_error(ErrorClass)
expect { ... }.to raise_error("message")
expect { ... }.to raise_error(ErrorClass, "message")
Equivalence
Comparisons
Types/classes
Expecting errors
Regular expressions
and much more…
[ rspec/expectations ]
Failed scenario with custom exception
$ DEBUG=1 bundle exec cucumber -p pages
Using the pages and common profiles...
@declarative
Feature: Sample shopping [declarative]
Scenario: Order a blue t-shirt
Given I have a valid user account
But I am an unauthenticated guest
…
Then I see details about chosen t-shirt
Selected color: Orange, but should be: Blue (RuntimeError)
./features/step_definitions/page_steps.rb:23:in `/^I see details about chosen t-shirt$/'
features/sample_shopping_declarative.feature:10:in `Then I see details about chosen t-shirt'
Failing Scenarios:
cucumber -p pages -p common features/sample_shopping_declarative.feature:4 # Scenario: Order a blue t-shirt
[ rspec/expectations ]
$ DEBUG=1 bundle exec cucumber -p pages
Using the pages and common profiles...
@declarative
Feature: Sample shopping [declarative]
Scenario: Order a blue t-shirt
Given I have a valid user account
But I am an unauthenticated guest
…
Then I see details about chosen t-shirt
expected: "Blue"
got: "Orange"
(compared using ==)
(RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/page_steps.rb:23:in `/^I see details about chosen t-shirt$/'
features/sample_shopping_declarative.feature:10:in `Then I see details about chosen t-shirt'
Failing Scenarios:
cucumber -p pages -p common features/sample_shopping_declarative.feature:4 # Scenario: Order a blue t-shirt
Failed scenario with rspec-expectation
[ helpful links ]
Idea of Cucumber: https://cucumber.io/blog/2014/03/03/the-worlds-most-misunderstood-collaboration-tool
Declarative/Imperative: http://itsadeliverything.com/declarative-vs-imperative-gherkin-scenarios-for-cucumber
Webdriver spec: https://www.w3.org/TR/webdriver/
Browser automation with Watir: https://binarapps.com/blog/browser-automation-with-watir-guide
Page Objects in Webdriver: https://github.com/SeleniumHQ/selenium/wiki/PageObjects
Watirsome gem: https://github.com/p0deje/watirsome
RSpec built-in matchers: https://relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
Another samples of cucumber + watir: https://github.com/spriteCloud/lapis-lazuli
Test Automation Websites #1: http://www.techbeamers.com/websites-to-practice-selenium-webdriver-online/
Test Automation Websites #2: https://www.ultimateqa.com/best-test-automation-websites-to-practice-using-
selenium-webdriver/
Questions
5 minutes.
You can also ask questions for me in the lounge zone

More Related Content

What's hot

Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassSpike Brehm
 
JSConf US 2014: Building Isomorphic Apps
JSConf US 2014: Building Isomorphic AppsJSConf US 2014: Building Isomorphic Apps
JSConf US 2014: Building Isomorphic AppsSpike Brehm
 
Building Isomorphic JavaScript Apps - NDC 2015
Building Isomorphic JavaScript Apps - NDC 2015Building Isomorphic JavaScript Apps - NDC 2015
Building Isomorphic JavaScript Apps - NDC 2015Eirik Vullum
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architectureGabriele Falace
 
Namespace less engine
Namespace less engineNamespace less engine
Namespace less engineshaokun
 
Isomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornIsomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornMaxime Najim
 
AngularJS with RequireJS
AngularJS with RequireJSAngularJS with RequireJS
AngularJS with RequireJSJohannes Weber
 
Modern JavaScript, without giving up on Rails
Modern JavaScript, without giving up on RailsModern JavaScript, without giving up on Rails
Modern JavaScript, without giving up on RailsJonathan Johnson
 
Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0 Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0 Sumanth Chinthagunta
 
Brief Introduction to Ember
Brief Introduction to EmberBrief Introduction to Ember
Brief Introduction to EmberVinay B
 
Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Nir Kaufman
 
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...Katy Slemon
 
Zend Server: Not just a PHP stack
Zend Server: Not just a PHP stackZend Server: Not just a PHP stack
Zend Server: Not just a PHP stackJeroen van Dijk
 
Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1David Amend
 
Tutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJSTutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJSPhilipp Burgmer
 
Fullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterFullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterMek Srunyu Stittri
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend TestingNeil Crosby
 
AngularJS meets Rails
AngularJS meets RailsAngularJS meets Rails
AngularJS meets RailsElena Torró
 
Workshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVCWorkshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVCVisual Engineering
 

What's hot (20)

Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master Class
 
JSConf US 2014: Building Isomorphic Apps
JSConf US 2014: Building Isomorphic AppsJSConf US 2014: Building Isomorphic Apps
JSConf US 2014: Building Isomorphic Apps
 
Building Isomorphic JavaScript Apps - NDC 2015
Building Isomorphic JavaScript Apps - NDC 2015Building Isomorphic JavaScript Apps - NDC 2015
Building Isomorphic JavaScript Apps - NDC 2015
 
AngularJS application architecture
AngularJS application architectureAngularJS application architecture
AngularJS application architecture
 
Namespace less engine
Namespace less engineNamespace less engine
Namespace less engine
 
Isomorphic JavaScript with Nashorn
Isomorphic JavaScript with NashornIsomorphic JavaScript with Nashorn
Isomorphic JavaScript with Nashorn
 
AngularJS with RequireJS
AngularJS with RequireJSAngularJS with RequireJS
AngularJS with RequireJS
 
Modern JavaScript, without giving up on Rails
Modern JavaScript, without giving up on RailsModern JavaScript, without giving up on Rails
Modern JavaScript, without giving up on Rails
 
Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0 Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0
 
Brief Introduction to Ember
Brief Introduction to EmberBrief Introduction to Ember
Brief Introduction to Ember
 
Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Angularjs - lazy loading techniques
Angularjs - lazy loading techniques
 
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
 
Zend Server: Not just a PHP stack
Zend Server: Not just a PHP stackZend Server: Not just a PHP stack
Zend Server: Not just a PHP stack
 
Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1
 
Introduction to angular 4
Introduction to angular 4Introduction to angular 4
Introduction to angular 4
 
Tutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJSTutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJS
 
Fullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterFullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year later
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend Testing
 
AngularJS meets Rails
AngularJS meets RailsAngularJS meets Rails
AngularJS meets Rails
 
Workshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVCWorkshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVC
 

Similar to End-to-end web-testing in ruby ecosystem

Building Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsBuilding Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsJim Jeffers
 
Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!cloudbring
 
Ninad cucumber rails
Ninad cucumber railsNinad cucumber rails
Ninad cucumber railsninad23p
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...Paul Jensen
 
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven DevelopmentCodefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven DevelopmentCodefresh
 
DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containersinside-BigData.com
 
Provisioning, deploying and debugging node.js applications on azure
Provisioning, deploying and debugging node.js applications on azureProvisioning, deploying and debugging node.js applications on azure
Provisioning, deploying and debugging node.js applications on azurePatriek van Dorp
 
20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdevFrank Rousseau
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & CucumberUdaya Kiran
 
Phoenix for Rails Devs
Phoenix for Rails DevsPhoenix for Rails Devs
Phoenix for Rails DevsDiacode
 
Ruby on Rails + AngularJS + Twitter Bootstrap
Ruby on Rails + AngularJS + Twitter BootstrapRuby on Rails + AngularJS + Twitter Bootstrap
Ruby on Rails + AngularJS + Twitter BootstrapMarcio Marinho
 
Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Brian Sam-Bodden
 
Capybara and cucumber with DSL using ruby
Capybara and cucumber with DSL using rubyCapybara and cucumber with DSL using ruby
Capybara and cucumber with DSL using rubyDeepak Chandella
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 
Test automation
Test automationTest automation
Test automationXavier Yin
 

Similar to End-to-end web-testing in ruby ecosystem (20)

Building Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsBuilding Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in Rails
 
Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!Rapid Prototyping FTW!!!
Rapid Prototyping FTW!!!
 
Ninad cucumber rails
Ninad cucumber railsNinad cucumber rails
Ninad cucumber rails
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
 
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven DevelopmentCodefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
Codefresh + Cloud 66 webinar: Testing Strategies for Docker Driven Development
 
DevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux ContainersDevOps Workflow: A Tutorial on Linux Containers
DevOps Workflow: A Tutorial on Linux Containers
 
rails.html
rails.htmlrails.html
rails.html
 
rails.html
rails.htmlrails.html
rails.html
 
Knolx session
Knolx sessionKnolx session
Knolx session
 
Provisioning, deploying and debugging node.js applications on azure
Provisioning, deploying and debugging node.js applications on azureProvisioning, deploying and debugging node.js applications on azure
Provisioning, deploying and debugging node.js applications on azure
 
Cucumber
CucumberCucumber
Cucumber
 
20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev
 
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber       Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
Behavioural Testing Ruby/Rails Apps @ Scale - Rspec & Cucumber
 
Phoenix for Rails Devs
Phoenix for Rails DevsPhoenix for Rails Devs
Phoenix for Rails Devs
 
Ruby on Rails + AngularJS + Twitter Bootstrap
Ruby on Rails + AngularJS + Twitter BootstrapRuby on Rails + AngularJS + Twitter Bootstrap
Ruby on Rails + AngularJS + Twitter Bootstrap
 
Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013
 
Dev streams2
Dev streams2Dev streams2
Dev streams2
 
Capybara and cucumber with DSL using ruby
Capybara and cucumber with DSL using rubyCapybara and cucumber with DSL using ruby
Capybara and cucumber with DSL using ruby
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 
Test automation
Test automationTest automation
Test automation
 

More from Alex Mikitenko

Testing stage. being ahead business with cucumber
Testing stage. being ahead business with cucumberTesting stage. being ahead business with cucumber
Testing stage. being ahead business with cucumberAlex Mikitenko
 
Dynamic Ruby. Lesson #5: define_method and its friends
Dynamic Ruby. Lesson #5: define_method and its friendsDynamic Ruby. Lesson #5: define_method and its friends
Dynamic Ruby. Lesson #5: define_method and its friendsAlex Mikitenko
 
Dynamic Ruby. Lesson #4: method_missing and its friends
Dynamic Ruby. Lesson #4: method_missing and its friendsDynamic Ruby. Lesson #4: method_missing and its friends
Dynamic Ruby. Lesson #4: method_missing and its friendsAlex Mikitenko
 
Dynamic Ruby. Lesson #3: Blocks, procs and lambdas
Dynamic Ruby. Lesson #3: Blocks, procs and lambdasDynamic Ruby. Lesson #3: Blocks, procs and lambdas
Dynamic Ruby. Lesson #3: Blocks, procs and lambdasAlex Mikitenko
 
Dynamic Ruby. Lesson #2: Methods and modules
Dynamic Ruby. Lesson #2: Methods and modulesDynamic Ruby. Lesson #2: Methods and modules
Dynamic Ruby. Lesson #2: Methods and modulesAlex Mikitenko
 
Dynamic Ruby. Lesson #1: Object model
Dynamic Ruby. Lesson #1: Object modelDynamic Ruby. Lesson #1: Object model
Dynamic Ruby. Lesson #1: Object modelAlex Mikitenko
 
Тестирование web-приложений на базе технологий Ruby/Cucumber/Watir Webdriver
Тестирование web-приложений на базе технологий Ruby/Cucumber/Watir WebdriverТестирование web-приложений на базе технологий Ruby/Cucumber/Watir Webdriver
Тестирование web-приложений на базе технологий Ruby/Cucumber/Watir WebdriverAlex Mikitenko
 
Ruby: интерпретируемый, динамичный, человеколюбивый
Ruby: интерпретируемый, динамичный, человеколюбивыйRuby: интерпретируемый, динамичный, человеколюбивый
Ruby: интерпретируемый, динамичный, человеколюбивыйAlex Mikitenko
 
Introduction to Ubuntu
Introduction to UbuntuIntroduction to Ubuntu
Introduction to UbuntuAlex Mikitenko
 

More from Alex Mikitenko (9)

Testing stage. being ahead business with cucumber
Testing stage. being ahead business with cucumberTesting stage. being ahead business with cucumber
Testing stage. being ahead business with cucumber
 
Dynamic Ruby. Lesson #5: define_method and its friends
Dynamic Ruby. Lesson #5: define_method and its friendsDynamic Ruby. Lesson #5: define_method and its friends
Dynamic Ruby. Lesson #5: define_method and its friends
 
Dynamic Ruby. Lesson #4: method_missing and its friends
Dynamic Ruby. Lesson #4: method_missing and its friendsDynamic Ruby. Lesson #4: method_missing and its friends
Dynamic Ruby. Lesson #4: method_missing and its friends
 
Dynamic Ruby. Lesson #3: Blocks, procs and lambdas
Dynamic Ruby. Lesson #3: Blocks, procs and lambdasDynamic Ruby. Lesson #3: Blocks, procs and lambdas
Dynamic Ruby. Lesson #3: Blocks, procs and lambdas
 
Dynamic Ruby. Lesson #2: Methods and modules
Dynamic Ruby. Lesson #2: Methods and modulesDynamic Ruby. Lesson #2: Methods and modules
Dynamic Ruby. Lesson #2: Methods and modules
 
Dynamic Ruby. Lesson #1: Object model
Dynamic Ruby. Lesson #1: Object modelDynamic Ruby. Lesson #1: Object model
Dynamic Ruby. Lesson #1: Object model
 
Тестирование web-приложений на базе технологий Ruby/Cucumber/Watir Webdriver
Тестирование web-приложений на базе технологий Ruby/Cucumber/Watir WebdriverТестирование web-приложений на базе технологий Ruby/Cucumber/Watir Webdriver
Тестирование web-приложений на базе технологий Ruby/Cucumber/Watir Webdriver
 
Ruby: интерпретируемый, динамичный, человеколюбивый
Ruby: интерпретируемый, динамичный, человеколюбивыйRuby: интерпретируемый, динамичный, человеколюбивый
Ruby: интерпретируемый, динамичный, человеколюбивый
 
Introduction to Ubuntu
Introduction to UbuntuIntroduction to Ubuntu
Introduction to Ubuntu
 

Recently uploaded

BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 

Recently uploaded (20)

BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 

End-to-end web-testing in ruby ecosystem

  • 1. End-to-end web-testing based on ruby/cucumber/watir/watirsome tech Alex Mikitenko
  • 2. Alex Mikitenko, Ukraine Lead QA Automation, Tech Team Labs • 10 years in the IT as a developer in test • Ruby fan • Anarchist https://www.linkedin.com/in/omykytenko/ https://www.slideshare.net/korvinua https://github.com/nonkor https://www.visualcv.com/alex-mikitenko
  • 3. [ description ] A classic task for an automation QA engineer these days: Developer and automate test coverage for some web or mobile software solution. This workshop offers a quick start for anyone who is interested to build a proper end-to-end test framework for those needs from the scratch. We will use robust and effective stack of technologies, verified by time and trusted by community: RUBY + CUCUMBER + WATIR + WATIRSOME + RSPEC/EXPECTATIONS Ready? Let’s start then!
  • 4. [ e2e-testing ] So, what is end-to-end testing? End-to-end testing is a methodology used to test whether the flow of an application is performing as designed from start to finish. The purpose of carrying out end-to-end tests is to identify system dependencies and to ensure that the right information is passed between various system components and systems. (via) techopedia.com
  • 5. [ testing pyramid ] (via) watirmelon.com
  • 6. [ ruby ] Why Ruby? - open source; - huge ecosystem; - human oriented standards; - truly OOP language; - powerful metaprogramming facilities; - DSL-oriented; - easy to learn (hardcode level included, but you need go deep to met it); - has trusted and robust tech stack for GUI web-automation; - I use it on a daily basis :)
  • 7. [ ruby ] Manage Ruby by rbenv # install rbenv $ brew update $ brew install rbenv $ rbenv init $ 'eval "$(rbenv init -)"' >> ~/.bash_profile # install ruby-build $ rbenv install -l # install ruby $ rbenv install 2.4.1 rbenv is lightweight Ruby version management tool
  • 8. [ ruby gems ] Manage Ruby gems by bundler bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed. # create project and go to it $ mkdir gui-test-sample $ cd gui-test-sample # install bundler $ gem install bundler $ bundle init # install gems $ ‘gem “cucumber”' >> ~/.bash_profile $ bundle install
  • 9. [ cucumber ] Why Cucumber? it’s collaboration tool allows you to run automated acceptance tests written in a BDD style - illustrates business rules, not just UI; - scenario writing does not require knowledge of specific programming language; - gives a possibility to write Cucumber scenarios before writing the code. Your cucumber features should drive your implementation, not reflect it. Andrew Premdas, one of the first adopters of Cucumber
  • 10. [ cucumber ] Initiate cucumber $ bundle exec cucumber --init features steps support storage of test scenarios storage of test step definitions storage of cucumber env files and hooks preloaded for every test run
  • 12. [ declarative vs. imperative ] is a programming paradigm that expresses the logic of a computation (what do) without describing its control flow (how do). Declarative programming Imperative programming is a programming paradigm that describes computation in terms of statements that change a program state.
  • 13. [ cucumber features ] Imperative style
  • 14. [ cucumber features ] Declarative style
  • 15. [ initiate project ] env.rb hooks.rb
  • 16. [ initiate project ] helper.rb settings.yml
  • 17. [ cucumber features ] First run $ bundle exec cucumber features/ sample_shopping_declarative.feature Using the default profile... Feature: Sample shopping [declarative] Scenario: Order a blue t-shirt … 1 scenario (1 undefined) 19 steps (19 undefined) 0m0.112s
  • 18. [ cucumber features ] Pending scenarios You can implement step definitions for undefined steps with these snippets: Given(/^I have a valid user account$/) do pending # Write code here that turns the phrase above into concrete actions end …
  • 19. [ watir ] Why Watir? - open source; - web application testing in ruby; - interacts with a browser the same way people do; - is not a record/playback tool; - has a clear and consistent API; - based on WebDriver (which is W3C Web Standard); - many of watir contributors are webdriver contributors, too; - used as a foundation for cross browser cloud services as saucelabs.com; - has page-object pattern extensions.
  • 20. [ watir ] Watir sample
  • 22. [ watir ] Why Page Objects? - Page Object pattern represents the screens of your web app as a series of objects and encapsulates the features represented by a page; - it allows us to model the UI in our tests; - a page object is an object-oriented class that serves as an interface to a page of your AUT.
  • 23. [ watir ] Page Object Model webdriver
  • 27. [ rspec/expectations ] rspec/expectations provides a simple, readable API to express expected outcomes of a code example expect(actual).to eq(expected) expect(actual).to eql(expected) expect(actual).not_to eql(not_expected) expect(actual).to be > expected expect(actual).to be < expected expect(actual).to be_within(delta).of(expected) expect(actual).to match(/expression/) expect(actual).to be_an_instance_of(expected) expect(actual).to be_a(expected) expect(actual).to be_an(expected) expect(actual).to be_a_kind_of(expected) expect { ... }.to raise_error expect { ... }.to raise_error(ErrorClass) expect { ... }.to raise_error("message") expect { ... }.to raise_error(ErrorClass, "message") Equivalence Comparisons Types/classes Expecting errors Regular expressions and much more…
  • 28. [ rspec/expectations ] Failed scenario with custom exception $ DEBUG=1 bundle exec cucumber -p pages Using the pages and common profiles... @declarative Feature: Sample shopping [declarative] Scenario: Order a blue t-shirt Given I have a valid user account But I am an unauthenticated guest … Then I see details about chosen t-shirt Selected color: Orange, but should be: Blue (RuntimeError) ./features/step_definitions/page_steps.rb:23:in `/^I see details about chosen t-shirt$/' features/sample_shopping_declarative.feature:10:in `Then I see details about chosen t-shirt' Failing Scenarios: cucumber -p pages -p common features/sample_shopping_declarative.feature:4 # Scenario: Order a blue t-shirt
  • 29. [ rspec/expectations ] $ DEBUG=1 bundle exec cucumber -p pages Using the pages and common profiles... @declarative Feature: Sample shopping [declarative] Scenario: Order a blue t-shirt Given I have a valid user account But I am an unauthenticated guest … Then I see details about chosen t-shirt expected: "Blue" got: "Orange" (compared using ==) (RSpec::Expectations::ExpectationNotMetError) ./features/step_definitions/page_steps.rb:23:in `/^I see details about chosen t-shirt$/' features/sample_shopping_declarative.feature:10:in `Then I see details about chosen t-shirt' Failing Scenarios: cucumber -p pages -p common features/sample_shopping_declarative.feature:4 # Scenario: Order a blue t-shirt Failed scenario with rspec-expectation
  • 30. [ helpful links ] Idea of Cucumber: https://cucumber.io/blog/2014/03/03/the-worlds-most-misunderstood-collaboration-tool Declarative/Imperative: http://itsadeliverything.com/declarative-vs-imperative-gherkin-scenarios-for-cucumber Webdriver spec: https://www.w3.org/TR/webdriver/ Browser automation with Watir: https://binarapps.com/blog/browser-automation-with-watir-guide Page Objects in Webdriver: https://github.com/SeleniumHQ/selenium/wiki/PageObjects Watirsome gem: https://github.com/p0deje/watirsome RSpec built-in matchers: https://relishapp.com/rspec/rspec-expectations/docs/built-in-matchers Another samples of cucumber + watir: https://github.com/spriteCloud/lapis-lazuli Test Automation Websites #1: http://www.techbeamers.com/websites-to-practice-selenium-webdriver-online/ Test Automation Websites #2: https://www.ultimateqa.com/best-test-automation-websites-to-practice-using- selenium-webdriver/
  • 31. Questions 5 minutes. You can also ask questions for me in the lounge zone