SlideShare a Scribd company logo
1 of 15
1Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
Behavior Driven Development
CUCUMBER
Chaitanya Kumar Reddy(338057) – 29/09/2015
2Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
 Introduction
 Behavior Driven Development
 Use vs. Don’t Use
 Cucumber Feature File
 Step Definition
 References
Agenda
3Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
Introduction
 Cucumber is a tool based on BDD (Behavior Driven Development) framework.
 Cucumber is used to write acceptance tests for a web application.
 It allows the developer to develop the test cases in a very easy way, that
everyone can understand.
 Cucumber was implemented in Ruby and later extended to Java.
 Cucumber can be used along with Selenium.
 Cucumber Supports many other languages like Perl, PHP, Python, .Net etc.
4Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
Behavior Driven Development (BDD)
 Behavior-driven development is an agile software development technique
that encourages collaboration between developers, QA and non-technical
participants in a software project.
 Behavior Driven Development is emerged from Test Driven Development.
TDD BDD
5Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
Use vs. Don’t Use
Cucumber is useful:
 Separation of examples and automation
 Possess structure but not too much
 Pressure to grow a ubiquitous language
 Just enough syntax
Cucumber is not useful:
 Small set of tests
 Too much overhead
 Only developers will look at the tests
 Working with Regular expressions
6Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
Cucumber Feature File
 Every cucumber project consists of a directory named features.
 This directory contains feature files with extension “.feature”
 Feature file contains following components:
 Feature
 Scenario/Scenario Outline
• Given
• When
• Then
• And
• But
7Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
Cucumber Feature File ..cont.
 Feature: This will describe about the current feature file.
 Scenario: Describes the steps and expected output for the test case.
- Below is the example for scenario:
8Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
Cucumber Feature File ..cont.
 Scenario Outline: A scenario that is executed for multiple sets of data. Below
is the example for defining Scenario Outline.
9Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
Cucumber Feature File ..cont.
 Given: Specifies the context of the test to be executed and puts the system in
known state.
 When: Specifies the key action to be performed.
 Then: Observes the output.
 And/But: If there are several ‘Given’s, ‘When’s and ‘Then’s. We can use
And/But to replace some of them.
10Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
Step Definition
 Every step in the feature file will be having a step definition.
 Step Definition will have the code to perform the actions.
 Step Definition will have the string that matches the string in feature file.
-- feature 
11Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
 Below are the step definitions for the above feature.
Step Definition ..cont.
12Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
Step Definition ..cont.
 In step definitions we will write selenium code to automate the test cases.
13Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
References
 https://github.com/cucumber/
14Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.
Disclaimer
Tech Mahindra Limited, herein referred to as TechM provide a wide array of presentations and reports, with the contributions of
various professionals. These presentations and reports are for informational purposes and private circulation only and do not
constitute an offer to buy or sell any securities mentioned therein. They do not purport to be a complete description of the markets
conditions or developments referred to in the material. While utmost care has been taken in preparing the above, we claim no
responsibility for their accuracy. We shall not be liable for any direct or indirect losses arising from the use thereof and the viewers are
requested to use the information contained herein at their own risk. These presentations and reports should not be reproduced, re-
circulated, published in any media, website or otherwise, in any form or manner, in part or as a whole, without the express consent in
writing of TechM or its subsidiaries. Any unauthorized use, disclosure or public dissemination of information contained herein is
prohibited. Unless specifically noted, TechM is not responsible for the content of these presentations and/or the opinions of the
presenters. Individual situations and local practices and standards may vary, so viewers and others utilizing information contained
within a presentation are free to adopt differing standards and approaches as they see fit. You may not repackage or sell the
presentation. Products and names mentioned in materials or presentations are the property of their respective owners and the
mention of them does not constitute an endorsement by TechM. Information contained in a presentation hosted or promoted by
TechM is provided “as is” without warranty of any kind, either expressed or implied, including any warranty of merchantability or
fitness for a particular purpose. TechM assumes no liability or responsibility for the contents of a presentation or the opinions
expressed by the presenters. All expressions of opinion are subject to change without notice.
Thank you
Chaitanyakumarreddy.thathagari@techmahindra.com
15Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.

More Related Content

Similar to Cucumber-III

Similar to Cucumber-III (20)

Bpmn
BpmnBpmn
Bpmn
 
Revised submission for Unified Component Model (UCM) for Distributed, Real-Ti...
Revised submission for Unified Component Model (UCM) for Distributed, Real-Ti...Revised submission for Unified Component Model (UCM) for Distributed, Real-Ti...
Revised submission for Unified Component Model (UCM) for Distributed, Real-Ti...
 
08-01-09
08-01-0908-01-09
08-01-09
 
Managed Platform for Adaptive Computing - mPAC
Managed Platform for Adaptive Computing - mPACManaged Platform for Adaptive Computing - mPAC
Managed Platform for Adaptive Computing - mPAC
 
DDS Security Specification (Adopted Beta1 June 2014)
DDS Security Specification (Adopted Beta1 June 2014)DDS Security Specification (Adopted Beta1 June 2014)
DDS Security Specification (Adopted Beta1 June 2014)
 
Create a MV file sharing module using R/Link
Create a MV file sharing module using R/LinkCreate a MV file sharing module using R/Link
Create a MV file sharing module using R/Link
 
Interface Definition Language (IDL) version 4.2
Interface Definition Language (IDL) version 4.2 Interface Definition Language (IDL) version 4.2
Interface Definition Language (IDL) version 4.2
 
OMG DDS Security Specification - 4th revised submission document
OMG DDS Security Specification - 4th revised submission documentOMG DDS Security Specification - 4th revised submission document
OMG DDS Security Specification - 4th revised submission document
 
ブロックチェーンの実用化に向けたネットワーク・スケーリング
ブロックチェーンの実用化に向けたネットワーク・スケーリングブロックチェーンの実用化に向けたネットワーク・スケーリング
ブロックチェーンの実用化に向けたネットワーク・スケーリング
 
#2 connected apps_calicut_31_july
#2 connected apps_calicut_31_july#2 connected apps_calicut_31_july
#2 connected apps_calicut_31_july
 
Rpc over-dds-rti-e prosima-twinoaks-submission-v5
Rpc over-dds-rti-e prosima-twinoaks-submission-v5Rpc over-dds-rti-e prosima-twinoaks-submission-v5
Rpc over-dds-rti-e prosima-twinoaks-submission-v5
 
Tech Mahindra - OpenStack Summit 2016/Red Hat NFV Mini Summit
Tech Mahindra - OpenStack Summit 2016/Red Hat NFV Mini SummitTech Mahindra - OpenStack Summit 2016/Red Hat NFV Mini Summit
Tech Mahindra - OpenStack Summit 2016/Red Hat NFV Mini Summit
 
Achieving DevOps using Open Source Tools in the Enterprise
Achieving DevOps using Open Source Tools in the EnterpriseAchieving DevOps using Open Source Tools in the Enterprise
Achieving DevOps using Open Source Tools in the Enterprise
 
Uml2 super.book.040324
 Uml2 super.book.040324 Uml2 super.book.040324
Uml2 super.book.040324
 
Traits of Future Ready Leaders
Traits of Future Ready LeadersTraits of Future Ready Leaders
Traits of Future Ready Leaders
 
What's New with Anypoint Platform? Unified Platform Management
What's New with Anypoint Platform? Unified Platform ManagementWhat's New with Anypoint Platform? Unified Platform Management
What's New with Anypoint Platform? Unified Platform Management
 
Extending Jenkins to the Mainframe. A Simpler Approach.
Extending Jenkins to the Mainframe.  A Simpler Approach.Extending Jenkins to the Mainframe.  A Simpler Approach.
Extending Jenkins to the Mainframe. A Simpler Approach.
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and Testing
 
RPC over DDS Beta 1
RPC over DDS Beta 1RPC over DDS Beta 1
RPC over DDS Beta 1
 
200 SNYPR Fundamentals Training Guide.pdf
200 SNYPR Fundamentals Training Guide.pdf200 SNYPR Fundamentals Training Guide.pdf
200 SNYPR Fundamentals Training Guide.pdf
 

Cucumber-III

  • 1. 1Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential. Behavior Driven Development CUCUMBER Chaitanya Kumar Reddy(338057) – 29/09/2015
  • 2. 2Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.  Introduction  Behavior Driven Development  Use vs. Don’t Use  Cucumber Feature File  Step Definition  References Agenda
  • 3. 3Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential. Introduction  Cucumber is a tool based on BDD (Behavior Driven Development) framework.  Cucumber is used to write acceptance tests for a web application.  It allows the developer to develop the test cases in a very easy way, that everyone can understand.  Cucumber was implemented in Ruby and later extended to Java.  Cucumber can be used along with Selenium.  Cucumber Supports many other languages like Perl, PHP, Python, .Net etc.
  • 4. 4Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential. Behavior Driven Development (BDD)  Behavior-driven development is an agile software development technique that encourages collaboration between developers, QA and non-technical participants in a software project.  Behavior Driven Development is emerged from Test Driven Development. TDD BDD
  • 5. 5Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential. Use vs. Don’t Use Cucumber is useful:  Separation of examples and automation  Possess structure but not too much  Pressure to grow a ubiquitous language  Just enough syntax Cucumber is not useful:  Small set of tests  Too much overhead  Only developers will look at the tests  Working with Regular expressions
  • 6. 6Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential. Cucumber Feature File  Every cucumber project consists of a directory named features.  This directory contains feature files with extension “.feature”  Feature file contains following components:  Feature  Scenario/Scenario Outline • Given • When • Then • And • But
  • 7. 7Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential. Cucumber Feature File ..cont.  Feature: This will describe about the current feature file.  Scenario: Describes the steps and expected output for the test case. - Below is the example for scenario:
  • 8. 8Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential. Cucumber Feature File ..cont.  Scenario Outline: A scenario that is executed for multiple sets of data. Below is the example for defining Scenario Outline.
  • 9. 9Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential. Cucumber Feature File ..cont.  Given: Specifies the context of the test to be executed and puts the system in known state.  When: Specifies the key action to be performed.  Then: Observes the output.  And/But: If there are several ‘Given’s, ‘When’s and ‘Then’s. We can use And/But to replace some of them.
  • 10. 10Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential. Step Definition  Every step in the feature file will be having a step definition.  Step Definition will have the code to perform the actions.  Step Definition will have the string that matches the string in feature file. -- feature 
  • 11. 11Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.  Below are the step definitions for the above feature. Step Definition ..cont.
  • 12. 12Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential. Step Definition ..cont.  In step definitions we will write selenium code to automate the test cases.
  • 13. 13Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential. References  https://github.com/cucumber/
  • 14. 14Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential. Disclaimer Tech Mahindra Limited, herein referred to as TechM provide a wide array of presentations and reports, with the contributions of various professionals. These presentations and reports are for informational purposes and private circulation only and do not constitute an offer to buy or sell any securities mentioned therein. They do not purport to be a complete description of the markets conditions or developments referred to in the material. While utmost care has been taken in preparing the above, we claim no responsibility for their accuracy. We shall not be liable for any direct or indirect losses arising from the use thereof and the viewers are requested to use the information contained herein at their own risk. These presentations and reports should not be reproduced, re- circulated, published in any media, website or otherwise, in any form or manner, in part or as a whole, without the express consent in writing of TechM or its subsidiaries. Any unauthorized use, disclosure or public dissemination of information contained herein is prohibited. Unless specifically noted, TechM is not responsible for the content of these presentations and/or the opinions of the presenters. Individual situations and local practices and standards may vary, so viewers and others utilizing information contained within a presentation are free to adopt differing standards and approaches as they see fit. You may not repackage or sell the presentation. Products and names mentioned in materials or presentations are the property of their respective owners and the mention of them does not constitute an endorsement by TechM. Information contained in a presentation hosted or promoted by TechM is provided “as is” without warranty of any kind, either expressed or implied, including any warranty of merchantability or fitness for a particular purpose. TechM assumes no liability or responsibility for the contents of a presentation or the opinions expressed by the presenters. All expressions of opinion are subject to change without notice. Thank you Chaitanyakumarreddy.thathagari@techmahindra.com
  • 15. 15Copyright © 2014. All Rights Reserved. l Tech Mahindra Confidential.