SlideShare una empresa de Scribd logo
1 de 31
Descargar para leer sin conexión
Automated Web
Acceptance Testing with
        Behat
        Shashikant Jagtap
      Twitter : @Shashikant86
Overview




    Behat : BDD for PHP

    Mink: Web Acceptance Testing Framework

    Behat with Sauce Labs for cloud testing

    Relish for living documentation

    Building feature with Jenkins

    Useful Links
Behat : BDD for PHP


    Behat is a BDD framework for PHP applications.
                     http://behat.org/




    BDD approach



    Feature is defined in story format.



    Domain Specific Language used is 'Gherkin'.



    Behat is developed by Konstantin Kudryashov (@everzet)
Mink


    Mink is a acceptance test framework for PHP applications
                   http://mink.behat.org/

  Mink has different drivers for browser emulation. Bowser emulation
can be headless or with browser controllers.
Mink supports both selenium1 driver as well as webdriver.




    Mink has various API's that can used to control browser actions.
Full list of Mink API's can found here




                 http://mink.behat.org/api/
Basic Browser Interactions
Source: http://mink.behat.org/
Installations


    Behat Installation: Run following commands from your pear channel
$ sudo pear channel-discover pear.behat.org
$ sudo pear channel-discover pear.symfony.com
$ sudo pear install behat/gherkin-beta
$ sudo pear install behat/behat-beta

    Mink Installation
$ pear channel-discover pear.symfony.com
$ pear channel-discover pear.behat.org
$ pear install behat/mink

    Check Installations
$ behat –version
   Behat version 2.2.0
Mink can be used by including following file in PHP classes.
    require_once 'mink/autoload.php';
Start Your Project

Navigate to the project root directory and initialize Behat by running these commands:
FeatureContext.php
Bootstrap.php

    Create 'features->bootstrap->bootstrap.php' and include mink and all other third
    party libraries in it.

    Include bootstrap.php into 'FeatureContext.php'.
Behat.yml

    Create 'behat.yml'. This is configuration file to run features

    You can specify mink driver, base url and browser of your choice.

    This file uses 'selenium' driver to run feature.
wikiSearch.feature

    Now, write sample feature file. This feature file good example of data-driven tests.
Get code for Step Definitions

    Now, you are ready to run 'behat' command again. This will give you example code for undefined
    steps
Implement Step definitions


    Now, copy example code and paste it in 'FeatureContext.php'

    Use Mink API's to implement steps like this
Start your engine

    Download Selenium from http://seleniumhq.org/download/

    Run Selenium server using command
    $java -jar selenium-server-standalone-2.15.0.jar
Watch your Test running

    Now run 'behat' again and watch your test running in browser.
Watch Your Test Passed
Behat with Sauce Labs

    Sauce Labs is a cloud testing service which allows tests to run in cloud machine with
    specified browser. http://saucelabs.com/

    Behat features can be run on sauce labs by simple configuration

    We need to create another configuration file to run features on Sauce Labs.
Create 'sauce.yml'

    In order to run feature on Sauce Labs, we need to create 'sauce.yml' as a
    config file. You need Sauce labs 'username' and 'API key'.
Run Feature on Sauce Labs

    You need to tell behat to pick 'sauce.yml' as config file
      $behat -c sauce.yml

    You can watch video this job here: http://snipurl.com/21y5lb6
Relish: Living Documentation


    Relish is cool tool to manage Gherkins feature files online.
    https://www.relishapp.com/relish/relish/docs

    Install Relish
You need to have Ruby gems installed on your system.
        $gem install relish

    Create Project
        $relish projects:add projectName
# or, if you want a private project:
        $relish projects:add my-secret-project:private

    Push your files online
       $relish push my-best-project
    moonstar:NewBehat sjagtap$ relish push sjagtap/acne
    sent:
    features/wikiSearch.feature
Relish


    You can find our feature on Relish here
    https://www.relishapp.com/sjagtap/acne/docs/wikisearch
Source Code from GitHub


Get Sample Source Code available on GitHub




       https://github.com/Shashi-ibuildings/Behat-Sauce
Clone the repository




     $ git clone git@github.com:Shashi-ibuildings/Behat-Sauce.git
     $ cd /path to/Behat-Sauce
Edit ‘Sauce.yml’ file in order to specify your username and API key. Now, Run



ANT command to execute feature on sauce Labs
      $ ant runSauce
See the reports generated in 'report/report.html' file.

Directory Structure


    Once you cloned project, You will have following files in the project,
    directory structure looks like this
Running Features on Jenkins

    Jenkins is continuous integration server

    To configure Behat with CI server, we need 'build.xml ' file

    You need to have Jenkins installed on server or localhost
- We will Run Jenkins
- moonstar:~ sjagtap$ java -jar jenkins-1.war

    Visit http://localhost:8080/ to see Jenkins Dashboard

    Create new job called “BehatSauce”. Specify it as 'Build a free-style
    software project.

    Specify Git repository as SCM.

    Select ‘Invoke Ant’ from ‘Build’ and specify ‘runSauce’ target

    Specify HTML report path. (You need to have HTML report plugin
    installed on Jenkins)
Jenkins Configuration
Jenkins Configuration Contd..
Jenkins Project
Jenkins Test Report
Links


     Blogpost 'Adding Sauce To behat'
http://saucelabs.com/blog/index.php/2012/01/adding-sauce-to-behat/

     Video Demo
http://www.youtube.com/watch?v=Zu9mWuVvsUQ

     Source Code on GitHub
    https://github.com/Shashi-ibuildings/Behat-Sauce

     Relish Documentation
https://www.relishapp.com/sjagtap/acne

     My Blogs
http://lestbddphp.wordpress.com/

     About Me
    http://about.me/shashikantjagtap
Questions
Thank You

Más contenido relacionado

La actualidad más candente

Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014Stéphane Bégaudeau
 
What's New in JHipsterLand - Devoxx Poland 2017
What's New in JHipsterLand - Devoxx Poland 2017What's New in JHipsterLand - Devoxx Poland 2017
What's New in JHipsterLand - Devoxx Poland 2017Matt Raible
 
Continous UI testing with Espresso and Jenkins
Continous UI testing with Espresso and JenkinsContinous UI testing with Espresso and Jenkins
Continous UI testing with Espresso and JenkinsSylwester Madej
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow soloviniciusban
 
Vietnam qa meetup
Vietnam qa meetupVietnam qa meetup
Vietnam qa meetupSyam Sasi
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Matt Raible
 
Mobile Web Test Automation: to the Desktop! - Alexander Bayandin - Mobile Tes...
Mobile Web Test Automation: to the Desktop! - Alexander Bayandin - Mobile Tes...Mobile Web Test Automation: to the Desktop! - Alexander Bayandin - Mobile Tes...
Mobile Web Test Automation: to the Desktop! - Alexander Bayandin - Mobile Tes...Badoo
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Adrian Philipp
 
An iOS Developer's Perspective on React Native
An iOS Developer's Perspective on React NativeAn iOS Developer's Perspective on React Native
An iOS Developer's Perspective on React NativeAleksandras Smirnovas
 
Ionic adventures - Hybrid Mobile App Development rocks
Ionic adventures - Hybrid Mobile App Development rocksIonic adventures - Hybrid Mobile App Development rocks
Ionic adventures - Hybrid Mobile App Development rocksJuarez Filho
 
Building a PWA with Ionic, Angular, and Spring Boot - GeeCON 2017
Building a PWA with Ionic, Angular, and Spring Boot - GeeCON 2017Building a PWA with Ionic, Angular, and Spring Boot - GeeCON 2017
Building a PWA with Ionic, Angular, and Spring Boot - GeeCON 2017Matt Raible
 
Using JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot appsUsing JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot appsYakov Fain
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsYakov Fain
 
No Va Taig April 7 2010
No Va Taig April 7 2010No Va Taig April 7 2010
No Va Taig April 7 2010rudy regner
 
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Bootiful Development with Spring Boot and Angular - Spring I/O 2017Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Bootiful Development with Spring Boot and Angular - Spring I/O 2017Matt Raible
 
Puppeteer: Getting Started
Puppeteer: Getting StartedPuppeteer: Getting Started
Puppeteer: Getting StartedHyunSeob Lee
 
Building the Front End with AngularJS
Building the Front End with AngularJSBuilding the Front End with AngularJS
Building the Front End with AngularJSJohn Ennew
 

La actualidad más candente (20)

Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014
 
What's New in JHipsterLand - Devoxx Poland 2017
What's New in JHipsterLand - Devoxx Poland 2017What's New in JHipsterLand - Devoxx Poland 2017
What's New in JHipsterLand - Devoxx Poland 2017
 
Continous UI testing with Espresso and Jenkins
Continous UI testing with Espresso and JenkinsContinous UI testing with Espresso and Jenkins
Continous UI testing with Espresso and Jenkins
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
 
Vietnam qa meetup
Vietnam qa meetupVietnam qa meetup
Vietnam qa meetup
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
 
Mobile Web Test Automation: to the Desktop! - Alexander Bayandin - Mobile Tes...
Mobile Web Test Automation: to the Desktop! - Alexander Bayandin - Mobile Tes...Mobile Web Test Automation: to the Desktop! - Alexander Bayandin - Mobile Tes...
Mobile Web Test Automation: to the Desktop! - Alexander Bayandin - Mobile Tes...
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016
 
React Native
React NativeReact Native
React Native
 
Autotesting rails app
Autotesting rails appAutotesting rails app
Autotesting rails app
 
An iOS Developer's Perspective on React Native
An iOS Developer's Perspective on React NativeAn iOS Developer's Perspective on React Native
An iOS Developer's Perspective on React Native
 
Ionic adventures - Hybrid Mobile App Development rocks
Ionic adventures - Hybrid Mobile App Development rocksIonic adventures - Hybrid Mobile App Development rocks
Ionic adventures - Hybrid Mobile App Development rocks
 
Building a PWA with Ionic, Angular, and Spring Boot - GeeCON 2017
Building a PWA with Ionic, Angular, and Spring Boot - GeeCON 2017Building a PWA with Ionic, Angular, and Spring Boot - GeeCON 2017
Building a PWA with Ionic, Angular, and Spring Boot - GeeCON 2017
 
Using JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot appsUsing JHipster 4 for generating Angular/Spring Boot apps
Using JHipster 4 for generating Angular/Spring Boot apps
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot apps
 
No Va Taig April 7 2010
No Va Taig April 7 2010No Va Taig April 7 2010
No Va Taig April 7 2010
 
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Bootiful Development with Spring Boot and Angular - Spring I/O 2017Bootiful Development with Spring Boot and Angular - Spring I/O 2017
Bootiful Development with Spring Boot and Angular - Spring I/O 2017
 
Puppeteer: Getting Started
Puppeteer: Getting StartedPuppeteer: Getting Started
Puppeteer: Getting Started
 
Building the Front End with AngularJS
Building the Front End with AngularJSBuilding the Front End with AngularJS
Building the Front End with AngularJS
 
Ionic2
Ionic2Ionic2
Ionic2
 

Destacado

Dockerizing BDD : Ruby-Cucumber Example
Dockerizing BDD : Ruby-Cucumber ExampleDockerizing BDD : Ruby-Cucumber Example
Dockerizing BDD : Ruby-Cucumber ExampleShashikant Jagtap
 
Exactpro Systems for KSTU Students in Kostroma
Exactpro Systems for KSTU Students in KostromaExactpro Systems for KSTU Students in Kostroma
Exactpro Systems for KSTU Students in KostromaIosif Itkin
 
Behavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsBehavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsIosif Itkin
 
Appium: Automation for Mobile Apps
Appium: Automation for Mobile AppsAppium: Automation for Mobile Apps
Appium: Automation for Mobile AppsSauce Labs
 
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigiReact Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigiYukiya Nakagawa
 

Destacado (6)

Headless BDD
Headless BDDHeadless BDD
Headless BDD
 
Dockerizing BDD : Ruby-Cucumber Example
Dockerizing BDD : Ruby-Cucumber ExampleDockerizing BDD : Ruby-Cucumber Example
Dockerizing BDD : Ruby-Cucumber Example
 
Exactpro Systems for KSTU Students in Kostroma
Exactpro Systems for KSTU Students in KostromaExactpro Systems for KSTU Students in Kostroma
Exactpro Systems for KSTU Students in Kostroma
 
Behavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsBehavior Driven Development Pros and Cons
Behavior Driven Development Pros and Cons
 
Appium: Automation for Mobile Apps
Appium: Automation for Mobile AppsAppium: Automation for Mobile Apps
Appium: Automation for Mobile Apps
 
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigiReact Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
 

Similar a Behat sauce

Setting up the hyperledger composer in ubuntu
Setting up the hyperledger composer in ubuntuSetting up the hyperledger composer in ubuntu
Setting up the hyperledger composer in ubuntukesavan N B
 
Php[tek] 2016 - BDD with Behat for Beginners
Php[tek] 2016 - BDD with Behat for BeginnersPhp[tek] 2016 - BDD with Behat for Beginners
Php[tek] 2016 - BDD with Behat for BeginnersAdam Englander
 
Continuous Integration using Jenkins with Python
Continuous Integration using Jenkins with PythonContinuous Integration using Jenkins with Python
Continuous Integration using Jenkins with PythonInexture Solutions
 
Integration and Acceptance Testing
Integration and Acceptance TestingIntegration and Acceptance Testing
Integration and Acceptance TestingAlan Hecht
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windowsDocker, Inc.
 
Infrastructure as code
Infrastructure as codeInfrastructure as code
Infrastructure as codedaisuke awaji
 
Using HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaUsing HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaSandeep Tol
 
Making a small QA system with Docker
Making a small QA system with DockerMaking a small QA system with Docker
Making a small QA system with DockerNaoki AINOYA
 
Jump into Squeak - Integrate Squeak projects with Docker & Github
Jump into Squeak - Integrate Squeak projects with Docker & GithubJump into Squeak - Integrate Squeak projects with Docker & Github
Jump into Squeak - Integrate Squeak projects with Docker & Githubhubx
 
Integration Testing with Behat drupal
Integration Testing with Behat drupalIntegration Testing with Behat drupal
Integration Testing with Behat drupalOscar Merida
 
Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopTutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopVivek Krishnakumar
 
Intro to Rails Give Camp Atlanta
Intro to Rails Give Camp AtlantaIntro to Rails Give Camp Atlanta
Intro to Rails Give Camp AtlantaJason Noble
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefNathen Harvey
 
Introduce fuego
Introduce fuegoIntroduce fuego
Introduce fuegos60030
 
When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?Niklas Heidloff
 
Añadiendo Jenkins al entorno para Integración continua
Añadiendo Jenkins al entorno para Integración continuaAñadiendo Jenkins al entorno para Integración continua
Añadiendo Jenkins al entorno para Integración continuaCésar Martín Ortiz Pintado
 

Similar a Behat sauce (20)

Setting up the hyperledger composer in ubuntu
Setting up the hyperledger composer in ubuntuSetting up the hyperledger composer in ubuntu
Setting up the hyperledger composer in ubuntu
 
Php[tek] 2016 - BDD with Behat for Beginners
Php[tek] 2016 - BDD with Behat for BeginnersPhp[tek] 2016 - BDD with Behat for Beginners
Php[tek] 2016 - BDD with Behat for Beginners
 
Continuous Integration using Jenkins with Python
Continuous Integration using Jenkins with PythonContinuous Integration using Jenkins with Python
Continuous Integration using Jenkins with Python
 
Integration and Acceptance Testing
Integration and Acceptance TestingIntegration and Acceptance Testing
Integration and Acceptance Testing
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windows
 
CodeShip
CodeShipCodeShip
CodeShip
 
Infrastructure as code
Infrastructure as codeInfrastructure as code
Infrastructure as code
 
Using HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaUsing HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in Java
 
Making a small QA system with Docker
Making a small QA system with DockerMaking a small QA system with Docker
Making a small QA system with Docker
 
Deployment automation
Deployment automationDeployment automation
Deployment automation
 
Jump into Squeak - Integrate Squeak projects with Docker & Github
Jump into Squeak - Integrate Squeak projects with Docker & GithubJump into Squeak - Integrate Squeak projects with Docker & Github
Jump into Squeak - Integrate Squeak projects with Docker & Github
 
Integration Testing with Behat drupal
Integration Testing with Behat drupalIntegration Testing with Behat drupal
Integration Testing with Behat drupal
 
Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopTutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer Workshop
 
Intro to Rails Give Camp Atlanta
Intro to Rails Give Camp AtlantaIntro to Rails Give Camp Atlanta
Intro to Rails Give Camp Atlanta
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
 
Session 2
Session 2Session 2
Session 2
 
Session 2
Session 2Session 2
Session 2
 
Introduce fuego
Introduce fuegoIntroduce fuego
Introduce fuego
 
When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?
 
Añadiendo Jenkins al entorno para Integración continua
Añadiendo Jenkins al entorno para Integración continuaAñadiendo Jenkins al entorno para Integración continua
Añadiendo Jenkins al entorno para Integración continua
 

Más de Shashikant Jagtap

NSTC2019: Choosing CI Friendly Mobile Automation Framework
NSTC2019: Choosing CI Friendly Mobile Automation Framework NSTC2019: Choosing CI Friendly Mobile Automation Framework
NSTC2019: Choosing CI Friendly Mobile Automation Framework Shashikant Jagtap
 
SauceCon19: Fashionable XCUITest for iOS App
SauceCon19: Fashionable XCUITest for iOS App SauceCon19: Fashionable XCUITest for iOS App
SauceCon19: Fashionable XCUITest for iOS App Shashikant Jagtap
 
XCUITest Introduction: Test Automation University
XCUITest Introduction: Test Automation University XCUITest Introduction: Test Automation University
XCUITest Introduction: Test Automation University Shashikant Jagtap
 
iOSDevUK Conference- DevOps for iOS Apps
iOSDevUK Conference- DevOps for iOS AppsiOSDevUK Conference- DevOps for iOS Apps
iOSDevUK Conference- DevOps for iOS AppsShashikant Jagtap
 
Provisioning iOS CI Server with Ansible
Provisioning iOS CI Server with AnsibleProvisioning iOS CI Server with Ansible
Provisioning iOS CI Server with AnsibleShashikant Jagtap
 
BDD with Behat Selenium, Sahi and Sauce
BDD with Behat Selenium, Sahi and SauceBDD with Behat Selenium, Sahi and Sauce
BDD with Behat Selenium, Sahi and SauceShashikant Jagtap
 
Test Framework for Acne Selenium+Sahi
Test Framework for Acne Selenium+SahiTest Framework for Acne Selenium+Sahi
Test Framework for Acne Selenium+SahiShashikant Jagtap
 

Más de Shashikant Jagtap (9)

NSTC2019: Choosing CI Friendly Mobile Automation Framework
NSTC2019: Choosing CI Friendly Mobile Automation Framework NSTC2019: Choosing CI Friendly Mobile Automation Framework
NSTC2019: Choosing CI Friendly Mobile Automation Framework
 
SauceCon19: Fashionable XCUITest for iOS App
SauceCon19: Fashionable XCUITest for iOS App SauceCon19: Fashionable XCUITest for iOS App
SauceCon19: Fashionable XCUITest for iOS App
 
Full Stack Flutter Testing
Full Stack Flutter Testing Full Stack Flutter Testing
Full Stack Flutter Testing
 
XCUITest Introduction: Test Automation University
XCUITest Introduction: Test Automation University XCUITest Introduction: Test Automation University
XCUITest Introduction: Test Automation University
 
iOSDevUK Conference- DevOps for iOS Apps
iOSDevUK Conference- DevOps for iOS AppsiOSDevUK Conference- DevOps for iOS Apps
iOSDevUK Conference- DevOps for iOS Apps
 
Vapor london March 2018
Vapor london March 2018Vapor london March 2018
Vapor london March 2018
 
Provisioning iOS CI Server with Ansible
Provisioning iOS CI Server with AnsibleProvisioning iOS CI Server with Ansible
Provisioning iOS CI Server with Ansible
 
BDD with Behat Selenium, Sahi and Sauce
BDD with Behat Selenium, Sahi and SauceBDD with Behat Selenium, Sahi and Sauce
BDD with Behat Selenium, Sahi and Sauce
 
Test Framework for Acne Selenium+Sahi
Test Framework for Acne Selenium+SahiTest Framework for Acne Selenium+Sahi
Test Framework for Acne Selenium+Sahi
 

Último

Secrets for A Happy Relationship & Marriage.
Secrets for A Happy Relationship & Marriage.Secrets for A Happy Relationship & Marriage.
Secrets for A Happy Relationship & Marriage.Surajkurrey
 
HVAC Replacement Process for Commercial Buildings Guide
HVAC Replacement Process for Commercial Buildings GuideHVAC Replacement Process for Commercial Buildings Guide
HVAC Replacement Process for Commercial Buildings Guideoutreachacdirect
 
Alex Gurkin: Strategies for a Sustainable Tech Career
Alex Gurkin: Strategies for a Sustainable Tech CareerAlex Gurkin: Strategies for a Sustainable Tech Career
Alex Gurkin: Strategies for a Sustainable Tech CareerAlex Gurkin
 
Bridging Cultures: Antique Indian Doors with Mediterranean Arches
Bridging Cultures: Antique Indian Doors with Mediterranean ArchesBridging Cultures: Antique Indian Doors with Mediterranean Arches
Bridging Cultures: Antique Indian Doors with Mediterranean ArchesEra Chandok
 
Oι πιο ευτυχισμένες και οι πιο δυστυχισμένες χώρες: Πρωτιά για τη Φινλανδία -...
Oι πιο ευτυχισμένες και οι πιο δυστυχισμένες χώρες: Πρωτιά για τη Φινλανδία -...Oι πιο ευτυχισμένες και οι πιο δυστυχισμένες χώρες: Πρωτιά για τη Φινλανδία -...
Oι πιο ευτυχισμένες και οι πιο δυστυχισμένες χώρες: Πρωτιά για τη Φινλανδία -...Newsroom8
 
Beyond Academics - Anibal Romero .pdf
Beyond Academics - Anibal Romero    .pdfBeyond Academics - Anibal Romero    .pdf
Beyond Academics - Anibal Romero .pdfroberttianibal
 
Boys Wholesale Clothing Online | Port 213
Boys Wholesale Clothing Online | Port 213Boys Wholesale Clothing Online | Port 213
Boys Wholesale Clothing Online | Port 213Port 213
 
The Heirloom Gown: A Tale of Love and Legacy
The Heirloom Gown: A Tale of Love and LegacyThe Heirloom Gown: A Tale of Love and Legacy
The Heirloom Gown: A Tale of Love and Legacyirumsohale
 

Último (8)

Secrets for A Happy Relationship & Marriage.
Secrets for A Happy Relationship & Marriage.Secrets for A Happy Relationship & Marriage.
Secrets for A Happy Relationship & Marriage.
 
HVAC Replacement Process for Commercial Buildings Guide
HVAC Replacement Process for Commercial Buildings GuideHVAC Replacement Process for Commercial Buildings Guide
HVAC Replacement Process for Commercial Buildings Guide
 
Alex Gurkin: Strategies for a Sustainable Tech Career
Alex Gurkin: Strategies for a Sustainable Tech CareerAlex Gurkin: Strategies for a Sustainable Tech Career
Alex Gurkin: Strategies for a Sustainable Tech Career
 
Bridging Cultures: Antique Indian Doors with Mediterranean Arches
Bridging Cultures: Antique Indian Doors with Mediterranean ArchesBridging Cultures: Antique Indian Doors with Mediterranean Arches
Bridging Cultures: Antique Indian Doors with Mediterranean Arches
 
Oι πιο ευτυχισμένες και οι πιο δυστυχισμένες χώρες: Πρωτιά για τη Φινλανδία -...
Oι πιο ευτυχισμένες και οι πιο δυστυχισμένες χώρες: Πρωτιά για τη Φινλανδία -...Oι πιο ευτυχισμένες και οι πιο δυστυχισμένες χώρες: Πρωτιά για τη Φινλανδία -...
Oι πιο ευτυχισμένες και οι πιο δυστυχισμένες χώρες: Πρωτιά για τη Φινλανδία -...
 
Beyond Academics - Anibal Romero .pdf
Beyond Academics - Anibal Romero    .pdfBeyond Academics - Anibal Romero    .pdf
Beyond Academics - Anibal Romero .pdf
 
Boys Wholesale Clothing Online | Port 213
Boys Wholesale Clothing Online | Port 213Boys Wholesale Clothing Online | Port 213
Boys Wholesale Clothing Online | Port 213
 
The Heirloom Gown: A Tale of Love and Legacy
The Heirloom Gown: A Tale of Love and LegacyThe Heirloom Gown: A Tale of Love and Legacy
The Heirloom Gown: A Tale of Love and Legacy
 

Behat sauce

  • 1. Automated Web Acceptance Testing with Behat Shashikant Jagtap Twitter : @Shashikant86
  • 2. Overview  Behat : BDD for PHP  Mink: Web Acceptance Testing Framework  Behat with Sauce Labs for cloud testing  Relish for living documentation  Building feature with Jenkins  Useful Links
  • 3. Behat : BDD for PHP  Behat is a BDD framework for PHP applications. http://behat.org/  BDD approach  Feature is defined in story format.  Domain Specific Language used is 'Gherkin'.  Behat is developed by Konstantin Kudryashov (@everzet)
  • 4. Mink  Mink is a acceptance test framework for PHP applications http://mink.behat.org/  Mink has different drivers for browser emulation. Bowser emulation can be headless or with browser controllers. Mink supports both selenium1 driver as well as webdriver.   Mink has various API's that can used to control browser actions. Full list of Mink API's can found here  http://mink.behat.org/api/
  • 5. Basic Browser Interactions Source: http://mink.behat.org/
  • 6. Installations  Behat Installation: Run following commands from your pear channel $ sudo pear channel-discover pear.behat.org $ sudo pear channel-discover pear.symfony.com $ sudo pear install behat/gherkin-beta $ sudo pear install behat/behat-beta  Mink Installation $ pear channel-discover pear.symfony.com $ pear channel-discover pear.behat.org $ pear install behat/mink  Check Installations $ behat –version Behat version 2.2.0 Mink can be used by including following file in PHP classes. require_once 'mink/autoload.php';
  • 7. Start Your Project Navigate to the project root directory and initialize Behat by running these commands:
  • 9. Bootstrap.php  Create 'features->bootstrap->bootstrap.php' and include mink and all other third party libraries in it.  Include bootstrap.php into 'FeatureContext.php'.
  • 10. Behat.yml  Create 'behat.yml'. This is configuration file to run features  You can specify mink driver, base url and browser of your choice.  This file uses 'selenium' driver to run feature.
  • 11. wikiSearch.feature  Now, write sample feature file. This feature file good example of data-driven tests.
  • 12. Get code for Step Definitions  Now, you are ready to run 'behat' command again. This will give you example code for undefined steps
  • 13. Implement Step definitions  Now, copy example code and paste it in 'FeatureContext.php'  Use Mink API's to implement steps like this
  • 14. Start your engine  Download Selenium from http://seleniumhq.org/download/  Run Selenium server using command $java -jar selenium-server-standalone-2.15.0.jar
  • 15. Watch your Test running  Now run 'behat' again and watch your test running in browser.
  • 16. Watch Your Test Passed
  • 17. Behat with Sauce Labs  Sauce Labs is a cloud testing service which allows tests to run in cloud machine with specified browser. http://saucelabs.com/  Behat features can be run on sauce labs by simple configuration  We need to create another configuration file to run features on Sauce Labs.
  • 18. Create 'sauce.yml'  In order to run feature on Sauce Labs, we need to create 'sauce.yml' as a config file. You need Sauce labs 'username' and 'API key'.
  • 19. Run Feature on Sauce Labs  You need to tell behat to pick 'sauce.yml' as config file $behat -c sauce.yml  You can watch video this job here: http://snipurl.com/21y5lb6
  • 20. Relish: Living Documentation  Relish is cool tool to manage Gherkins feature files online. https://www.relishapp.com/relish/relish/docs  Install Relish You need to have Ruby gems installed on your system. $gem install relish  Create Project $relish projects:add projectName # or, if you want a private project: $relish projects:add my-secret-project:private  Push your files online $relish push my-best-project moonstar:NewBehat sjagtap$ relish push sjagtap/acne sent: features/wikiSearch.feature
  • 21. Relish  You can find our feature on Relish here https://www.relishapp.com/sjagtap/acne/docs/wikisearch
  • 22. Source Code from GitHub Get Sample Source Code available on GitHub  https://github.com/Shashi-ibuildings/Behat-Sauce Clone the repository  $ git clone git@github.com:Shashi-ibuildings/Behat-Sauce.git $ cd /path to/Behat-Sauce Edit ‘Sauce.yml’ file in order to specify your username and API key. Now, Run  ANT command to execute feature on sauce Labs $ ant runSauce See the reports generated in 'report/report.html' file. 
  • 23. Directory Structure  Once you cloned project, You will have following files in the project, directory structure looks like this
  • 24. Running Features on Jenkins  Jenkins is continuous integration server  To configure Behat with CI server, we need 'build.xml ' file  You need to have Jenkins installed on server or localhost - We will Run Jenkins - moonstar:~ sjagtap$ java -jar jenkins-1.war  Visit http://localhost:8080/ to see Jenkins Dashboard  Create new job called “BehatSauce”. Specify it as 'Build a free-style software project.  Specify Git repository as SCM.  Select ‘Invoke Ant’ from ‘Build’ and specify ‘runSauce’ target  Specify HTML report path. (You need to have HTML report plugin installed on Jenkins)
  • 29. Links  Blogpost 'Adding Sauce To behat' http://saucelabs.com/blog/index.php/2012/01/adding-sauce-to-behat/  Video Demo http://www.youtube.com/watch?v=Zu9mWuVvsUQ  Source Code on GitHub https://github.com/Shashi-ibuildings/Behat-Sauce  Relish Documentation https://www.relishapp.com/sjagtap/acne  My Blogs http://lestbddphp.wordpress.com/  About Me http://about.me/shashikantjagtap