Ellen Lippe @ellen.lippe ellen.lippe@yahoo · [email protected] Ellen Lippe @ellen.lippe 8...
Transcript of Ellen Lippe @ellen.lippe ellen.lippe@yahoo · [email protected] Ellen Lippe @ellen.lippe 8...
- and automated feature specifications
Ellen [email protected]@yahoo.com
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
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
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..
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
Ellen Lippe
@ellen.lippe
Behave for Python
Specflow for .Net
Jbehave for Java
Cucumber for Ruby (and Java, .Net ++)
9
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
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
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?
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
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
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
Ellen [email protected]@yahoo.com