23
Let’s cook cucumber!! vodQA Pune 2016 Pranjali Talekar Amit Gundiyal Abhay Dalvi Pranathi Birudugadda

Lets cook cucumber !!

  • Upload
    vodqa

  • View
    151

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Lets cook cucumber !!

Let’s cook cucumber!!

vodQA Pune 2016

Pranjali Talekar

Amit Gundiyal

Abhay Dalvi

Pranathi Birudugadda

Page 2: Lets cook cucumber !!

Agenda

Welcome note, Expectation setting, Group split up

Installations

Discussion about BDD and Cucumber

Setup project framework

Hands-on workshop

Advanced Features Demo

Q&A + Feedback

Page 3: Lets cook cucumber !!

#vodqa#thoughtworks

Page 4: Lets cook cucumber !!

INTRODUCTION TO BDD

Page 5: Lets cook cucumber !!

BDD is...

“Behaviour-driven development is about implementing an application by describing its behaviour from the perspective of its stakeholders”

- Dan North

Page 6: Lets cook cucumber !!

BDD (Contd…)

It is an agile software development practice that has evolved from TDD (Test Driven Development).

The premise of BDD is to bring technology and business together.

So, As the name suggests, the practice recommends defining the behavior upfront and using the same to drive the product development.

Page 7: Lets cook cucumber !!

It has evolved from TDD. So there was something amiss in TDD that led to this evolution. Right ?

No clarity of how much to test. i.e. should we test for negative numbers, should we test for decimal etc. There is a clear chance of missing an expected behavior of the method while implementing it.

It is not driven through a specification or the so called desired behavior. And because of this, the boundaries are not clear.

Why BDD ?

Page 8: Lets cook cucumber !!

MindsetTooling support

BDD expects the desired behavior to be written in a Given, When, Then format...

Given describes the pre-requisites for the expectationWhen describes the actual steps to carry on the effect

of the expectationThen describes the verification that the expectations

were met.

How to adopt BDD ?

Page 9: Lets cook cucumber !!

Benefits of BDDUsability

System functionality is more deliberateDeveloper is placed into the paradigm of a user of the systemFewer defects

Live documentationLiving specificationTests describe the behaviour of the system

Higher code qualityTestable code tends to follow better design patterns ( more modular code , flexible ,

understandable etc).

Confidence Tests cover smaller, incremental slices of the system.Tests act as safety net covering existing functionality.

Faster Delivery Tests allow new features to be added more easily without breaking existing ones.Misunderstanding of requirements appear earlier in development cycle.

Page 10: Lets cook cucumber !!

Popular BDD testing Tools

Cucumber (https://cucumber.io)

Jasmine (http://jasmine.github.io)

JBehave (http://jbehave.org)

Concordian (http://concordion.org)

easyb (http://easyb.org)

Page 11: Lets cook cucumber !!
Page 12: Lets cook cucumber !!

Introduction To Cucumber

❏ Type : Behavior driven development framework / Collaboration tool / Test tool

❏ Written in : Ruby❏ Operating system : Cross-platform❏ Supports about 60+ languages❏ Automation can be written in own favorite language ( Ruby,

Java, c#.net , JavaScript, Scala, Groovy, Jython, Python, Perl, C++ etc)

❏ Helps to execute plain text functional descriptions as automated tests

❏ Writing scenarios before code enables programmers to be guided by an unambiguous specification

Page 13: Lets cook cucumber !!
Page 14: Lets cook cucumber !!

How Cucumber executes a scenario ?

Page 15: Lets cook cucumber !!

INTRODUCTION TO FRAMEWORK

Page 16: Lets cook cucumber !!

Framework Ecosystem

Page 17: Lets cook cucumber !!

In a tool we want...

Simplicitybecause who doesn’t like simple!!

Maintainabilitybecause everyone has been on a long running project and we know it is hell to keep tests working

Customizedbecause we all have our own preferences

Speedbecause we all have that need for speed

Page 18: Lets cook cucumber !!

Understanding Gherkin Syntax

Feature: Cucumber mandates to write a brief feature description of the scenarios you want to write in a feature file.Provide a high-level description of a software feature, and to group related scenarios.

Scenario: Before writing any scenario it also mandates the user to write a brief scenario description.

Given/When/Then/And - Every step in your scenario would be starting with one of them.

Page 19: Lets cook cucumber !!

Example - Gherkin Syntax

Given [Pre - condition]

When [Action performed]

Then [Result]

Example:Feature: Refund item

Scenario: John returns a faulty microwave

Given John has bought a microwave for $100 And he has a receipt When he returns the microwave Then John should be refunded $100

Page 20: Lets cook cucumber !!

HANDS ON

Page 21: Lets cook cucumber !!

Advanced Features Demo

Data driven Execution

Table driven execution

Background

Hooks

Tags

Running through CLI ( JUnit way ).

Reports

Page 22: Lets cook cucumber !!

Suggested Reading

http://dannorth.net/introducing-bdd/

http://behaviourdriven.org/

http://guide.agilealliance.org/guide/bdd.html

http://dannorth.net/2012/05/31/bdd-is-like-tdd-if/

http://lizkeogh.com/behaviour-driven-development/

http://lizkeogh.com/2012/05/30/showcasing-the-language-of-bdd/

http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-

user-stories.html

The Cucumber Book