bdd with cucumber and java

10
Behaviour Driven Development using Cucumber and Java Srinivas Katakam Presented to JUG Hyderabad 11-February-2017

Upload: srinivas-katakam

Post on 16-Apr-2017

78 views

Category:

Software


0 download

TRANSCRIPT

Page 1: BDD WITH CUCUMBER AND JAVA

Behaviour Driven Development using Cucumber and Java

Srinivas Katakam

Presented to JUG Hyderabad11-February-2017

Page 2: BDD WITH CUCUMBER AND JAVA

About the talk

• BDD in a Nutshell• BDD format• BDD with Cucumber• Cucumber Stack and advantages• Cucumber-JVM• Using Cucumber and Java with IntelliJ• Geb• Demo• Questions

Page 3: BDD WITH CUCUMBER AND JAVA

BDD in a Nutshell

BDD is a process designed to aid the management and the delivery of software development projects by improving communication between engineers and business professionals. In so doing, BDD ensures all development projects remain focused on delivering what the business actually needs while meeting all requirements of the user.

Page 4: BDD WITH CUCUMBER AND JAVA

BDD Format

User StoryAs a [X]

I want [Y]so that [Z]

Scenario

Given some initial context (the givens),

When an event occurs,

then ensure some outcomes.

Page 5: BDD WITH CUCUMBER AND JAVA

BDD with Cucumber

• Cucumber is an open sourcetool that is used to support Behaviour Driven Development with plain text specifications• Implementations of

Cucumber exist for number of platforms, including Java

Page 6: BDD WITH CUCUMBER AND JAVA

Cucumber Stack and advantages

A single source of truth

• Cucumber merges specification and test documentation into one cohesive whole

Focus on the customer

• Cucumber's executable specifications encourage closer collaboration, helping teams keep the business goal in mind at all times

Less rework

• Protect teams from costly regressions

Cucumber Stack

Page 7: BDD WITH CUCUMBER AND JAVA

Cucumber-JVM

Cucumber-JVM is a

Cucumber implementation for the most popular JVM

languages

Running Cucumber•JUnit Runner•CLI Runner•Android Runner

•Third party runners

Page 8: BDD WITH CUCUMBER AND JAVA

Using Cucumber and Java with IntelliJ

New Maven Project

Add the pom.xml repository and dependencies

Add source folder, “src/test/resources”

Delete the App.java and AppTests.java files

Add the CukesRunner class

Settings -> Plugins -> Search for “Cucumber for Java” and install

Add the feature file and step class

Page 9: BDD WITH CUCUMBER AND JAVA

Geb

GEB is a Web automation framework using groovy

It is a wrapper over selenium and provides a lot of inbuilt utilities that will allow the end user to jump into the job of automating their testcases and validating their application within a short period

Geb provides a enhanced Page Object modelling to its users with the advantage of reusability and maintainability of tests and framework

Page 10: BDD WITH CUCUMBER AND JAVA

Questions???