Share
Embed
BDD Presentation
Agile Cincinnati presentation 05-07-2018
What is BDD from the context of discovering examples.
chuck suscheck
May 07, 2018
Transcript
42 slides
-
What’s the costliest problem with software? q Bugs q Users
don’t use part of the product q Developers are highly paid q QA takes an unpredictable amount of time q Requirements are misunderstood q Technology is ever changing -
Evolution of requirements The system shall sort the account report
by dates The system displays the account report request screen The user selects the report The system displays the report with sort options The user selects sort on date The system sorts the report The system displays the report As an account collections specialist I want to see a report organized So that I can find late or nearly late payments IEEE 830-style Use cases User Story Understanding the why Enhancing innovation -
Title Body As a < role > I want to
< do something > So that < I get business value > Acceptance criteria Verify that . . . Verify that . . . Verify that . . . Story Template -
. . . . Iterative Product Backlog Refinement 100% Story
Title 50% Groomed with AC 70% Story Body 25% Groomed again 2 sprints sprint ready Sprint Planned Story Format Title: <some title> Body: As a <role> I want <to do something> So that <value> Acceptance Criteria: -Verify that <situation> -Verify that <situation> -Verify that <situation> -
Backlog refinement Product Backlog refinement is the act of adding
detail, estimates, and order to items in the Product Backlog. This is an ongoing process in which the Product Owner and the Development Team collaborate on the details of Product Backlog items. During Product Backlog refinement, items are reviewed and revised. The Scrum Team decides how and when refinement is done. -
1. Workflow Steps 2. Role variations 3. Business Rule Variations
4. Major Effort 5. Simple to Complex 6. Variations of Data 7. Data Entry Methods 8. Deferred Performance 9. CRUD 10. Acceptance Criteria 11. SPIKE Story Refinement Patterns -
Acceptance Criteria Method Acceptance Criteria The conditions that a software
product must satisfy to be accepted by a user or customer. Rule One of a set of explicit or understood regulations or principles governing conduct within a particular activity or sphere. Acceptance criteria = Type of rule -
Use Inductive Reasoning Inductive reasoning moves from specific instances into
a generalized conclusion • Deductive reasoning moves from generalized principles that are known to be true to a true and specific conclusion. Inductive reasoning is good for examining information closely, looking for hidden relationships, generating tentative hypotheses, and drawing conclusions that are not explicitly stated -
Inductive rule generation • Use rules to determine examples which
in turn adds more rules • New rules help induce details into the user story • Details in story help to refine story into more stories -
Discover Automate Formulate BDD "BDD practitioners explore, discover, define then
drive out the desired behavior of software using conversation, concrete examples and automated tests" Matt Wynne, The Cucumber Book Given, when, then Examples and rules Tools -
The components • Discovery • Using examples to drive out
story details, acceptance criteria, and new stories • Formulation • Using the examples to create a standardized (ubiquitous) language • Automation • Using the ubiquitous language to drive out automated specification verifications (tests) -
What to focus on in BDD Discover Formulate Automate Discover
Formulate Automate Benefits Effort to Enact Discover Formulate Automate Effectiveness for Refinement -
How much of each in the backlog? Formulate Automate Discover
Backlog Bottom Backlog Top -
Discover Automate Formulate Example Mapping Cucumber/Specflow Gherkin Some BDD Tools
Given, when, then Regex, datatables, outlines -
Example Example is an instance (such as a problem to
be solved) serving to illustrate a rule or precept or to act as an exercise in the application of a rule Roughly speaking Rules become acceptance criteria Examples become tests -
Discover with Examples Convert example into Scenario Implement Scenario Write
a failing unit test Make the test pass Refactor Code Refactor Scenario Pick a story start TDD BDD Discover Formulate Automate Our focus -
Transfer from Savings to Checking Body As a banking account
holder I want to transfer money from my savings account to my checking account So that I can have direct access to my money through checking Acceptance Criteria When transferring money to the checking, the checking will be incremented by the transfer amount and the savings will be decremented by the savings amount -
Pick a Rule Add examples Add new rules Split story
Purpose is to use rules to make examples and new rules Question ? -
Adding Examples When transferring money to the checking, the checking
will be incremented by the transfer amount and the savings will be decremented by the savings amount -
Formatting Examples When transferring money to the checking, the checking
will be incremented by the transfer amount and the savings will be decremented by the savings amount Context Action Outcome -
. . . . When do you do this? 100%
Story Title 50% Groomed with AC 70% Story Body 25% Groomed again 2 sprints sprint ready Sprint Planned + during the sprint -
Basic Gherkin Syntax Given When Then And But * #
(Comments) Scenario: Feature: Numbers become an input “quote” makes the string an input -
Overview of components Business side deals with feature file Implementation
side deals with step defs file Many to many relationship possible Feature File Step Def Files Magic tool Business Side Implementation Side -
Translation @Given("^I enter (\\d+) and -?(\\d+)$") public void i_enter_and(int arg1,
int arg2) throws Throwable { myCalculator.insertNumber(arg1); myCalculator.insertNumber(arg2); // throw new PendingException(); } @When("^I press \"(w*?)\"$") public void i_press(String arg1) throws Throwable { myCalculator.press(arg1); } @Then("^I will see -?(\\d+)$") public void i_will_see(int arg1) throws Throwable { int result = myCalculator.getResult(); Assert.assertEquals("Test failed", arg1, result); // throw new PendingException(); } -
Scenario Outlines Make several scenarios from a table <…..> is
substituted for table values Scenario Outline: Given I have <weight> When I enter <height> Then I will compute <mass> Examples: |weight | height | mass | |120 |100 |200 | |320 |450 |900 | This translates into 2 scenarios in the background