Ellen Lippe @ellen.lippe ellen.lippe@yahoo · [email protected] Ellen Lippe @ellen.lippe 8...

18
- and automated feature specifications Ellen Lippe @ellen.lippe [email protected]

Transcript of Ellen Lippe @ellen.lippe ellen.lippe@yahoo · [email protected] Ellen Lippe @ellen.lippe 8...

Page 1: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

- and automated feature specifications

Ellen [email protected]@yahoo.com

Page 2: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe2

Developer (me..)Tester (you?..)

Page 3: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe3

Better communcation and cooperation◦ Among testers, developers, users, business analysts....

Better software◦ Predictable behaviour◦ Bugfree◦ Easy to change◦ Easy to extend◦ Fast to re-test

My experience ◦ from various teams, products and programming languages◦ gains and challenges

Page 4: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe4

TDD

Gherkin

Domain Driven Design

Page 5: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe5

BDD is a second-generation, outside–in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.

Dan North

Page 6: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe

The essense:

◦ A mindset

◦ A technique

Page 7: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe7

How to approach software engineering?

◦ What’s the starting point?

◦ How do we collaborate?

.......The feature

....... We do! All the time..

Page 8: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe8

Feature: Basic ArithmeticAs a scientistI need to be able to calculate numbersSo that I can ......

Scenario: AdditionGiven a calculator I just turned onWhen I add 3 and 4Then the result is 7

Scenario: SubtractionGiven a calculator I just turned onWhen I subtract 5 from 9Then the result is 4

Scenario: Another addition

Feature specification- gherkin syntax

@given(”a calculator I just turned on”)

public void given():

calculator = new Calculator()

calculator.turn_on()

@when(”I add {number1} and {number2}”)

public void when(int number1, int number2):

result = calculator.add(number1,number2)

@then(”the result is {expected_result}”)

public void then (int expected_result):

assert result==expected_result

Step implementation- any language

public class Calculator:

public void turn_on()

on = True

public int add (int num1, int num2)

if on:

return num1 + num2

public int subtract(int num1, int num2)

if on:

return num1 – num2

Sofware source code

IDE/Test run tools

Page 9: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe

Behave for Python

Specflow for .Net

Jbehave for Java

Cucumber for Ruby (and Java, .Net ++)

9

Page 10: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe

10

Feature: Basic ArithmeticAs a scientistI need to be able to calculate numbersSo that I can ......

Scenario: AdditionGiven a calculator I just turned onWhen I add 3 and 4Then the result is 7

Scenario: SubtractionGiven a calculator I just turned onWhen I subtract 5 from 9Then the result is 4

Scenario: Another addition

Page 11: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe11

Implementation

Testing / feature verification

Operation/Maintenance

Feature wishuser

user BA

Communication

Feature specification

user

BA

developer

developer

Feature: Basic ArithmeticAs a scientistI need to be able to calculate numbersSo that I can ......

Scenario: AdditionGiven a calculator I just turned onWhen I add 3 and 4Then the result is 7

Scenario: SubtractionGiven a calculator I just turned onWhen I subtract 5 from 9Then the result is 4

Scenario: Another addition

Page 12: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe12

How to make sure that we create what the user needs?

Page 13: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe13

!!

user

BA

developer

Docs

=> Common understanding on right level

IT

Feature: Basic ArithmeticAs a scientistI need to be able to calculate numbersSo that I can ......

Scenario: AdditionGiven a calculator I just turned onWhen I add 3 and 4Then the result is 7

Scenario: SubtractionGiven a calculator I just turned onWhen I subtract 5 from 9Then the result is 4

Scenario: Another addition

How to make sure that we create what the user needs?

Page 14: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe14

More robust code, that’s easy to change and extend, and with less bugs (none?)

With automated feature tests I....:

◦ ...know exactly what to implement◦ don’t spend money on creating a rolls royce if this is not in spec◦ sufficient detail level

◦ ... can focus more◦ use all my developer skills in how to code,

not mixed with understanding/remembering what◦ one feature at a time

◦ ...know that I don’t break any existing functionality◦ risk free refactoring to enhance application capabilities◦ don’t introduce bugs◦ safetynet

Page 15: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe15

Testing and implementation merge

Change the way we work

Automated and manual tests complement each other => complete test suite

Feature: Basic ArithmeticAs a scientistI need to be able to calculate numbersSo that I can ......

Scenario: AdditionGiven a calculator I just turned onWhen I add 3 and 4Then the result is 7

Scenario: SubtractionGiven a calculator I just turned onWhen I subtract 5 from 9Then the result is 4

Scenario: Another addition

◦ More involved in development process◦ Overall flow/smoketests

◦ More involved in testing◦ Communicates needed test effort

Page 16: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe16

Communication◦ Later me, other developers, OM

Documentation◦ Top level

◦ Up to date

◦ Accurate with respect to what’s implemented

Changed/new functionality◦ Implement knowing that feature tests will tell you

immediately if your change introduces a bug

Regression testing◦ Not necessary

Page 17: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

[email protected]

Ellen Lippe

@ellen.lippe17

Page 18: Ellen Lippe @ellen.lippe ellen.lippe@yahoo · ellen.lippe@yahoo.com Ellen Lippe @ellen.lippe 8 Feature: Basic Arithmetic As a scientist I need to be able to calculate numbers So that

Ellen [email protected]@yahoo.com