bdd testing with cucumber

11
BDD Testing with Cucumber Dev.Talk. Zürich. 19. Sept 2012

Upload: daniel-kummer

Post on 29-Nov-2014

2.311 views

Category:

Technology


4 download

DESCRIPTION

How to do behavior driven development with cucumber, generate easy readable and understandable test reports for your business.

TRANSCRIPT

Page 1: BDD testing with cucumber

BDD Testing with Cucumber

Dev.Talk. Zürich. 19. Sept 2012

Page 2: BDD testing with cucumber

BDD

Business• Domain

driven design

Technology• Test driven

development

Page 3: BDD testing with cucumber

Core Principles

1. Enough is enough do as much planning, analysis, and design as you need, but no more.

2. Deliver stakeholder value everything you do should deliver value or increase your ability to do so.

3. It’s a behavior everyone involved should have the same way of talking about the system and what it does.

Page 4: BDD testing with cucumber

describe the behavior of your software in a very understandable way

Page 5: BDD testing with cucumber

1 Describe Behaviour

2 Write step definition

3 Run and fail

4 Write code to make

step pass

5 Run and pass

Page 6: BDD testing with cucumber

Behavior

Feature: <short description> <story> <scenario 1> <scenario n>

WHO? As a <role>WHAT? I want <feature>WHY? so that <business value>

Scenario: <description>Given <preconditions, context>[And] <additional preconditions>When <action, behaviour>Then <postconditions>[And] <additional

postconditions>

Page 7: BDD testing with cucumber

Step definition

• Regex based• Reusable• Cucumber gives you copy & paste

code

Page 8: BDD testing with cucumber

Human Language support

# language: deFunktionalität: Addition Um dumme Fehler zu vermeiden möchte ich als Matheidiot die Summe zweier Zahlen gesagt bekommen

Szenariogrundriss: Zwei Zahlen hinzufügen Angenommen ich habe <Eingabe_1> in den Taschenrechner eingegeben Und ich habe <Eingabe_2> in den Taschenrechner eingegeben Wenn ich <Knopf> drücke Dann sollte das Ergebniss auf dem Bildschirm <Ausgabe> sein

Beispiele: | Eingabe_1 | Eingabe_2 | Knopf | Ausgabe | | 20 | 30 | add | 50 | | 2 | 5 | add | 7 | | 0 | 40 | add | 40 |

Page 9: BDD testing with cucumber

What about Java, .net, …?

Java: Cucumber-Jvm • Pure Java• Supports: Java, JavaScript, JRuby,

Scala, Python, Groovy, Ioke

.NET: IronRuby• Cucumber Wrapper for IronRuby

Page 10: BDD testing with cucumber

Testing possibilities…

• Selenium browser testing• Webrat acceptance testing• Interface testing (example mozo poc)• Many many more – just take a look at

the cucumber tutorials

Page 11: BDD testing with cucumber

More Information

https://github.com/cucumber/cucumber/wiki

http://behaviour-driven.org/