How to become a specification by example rocket
How to become a 'specification by example' rocket scientist Kirsten Eriksen, Senior Consultant Ben Hughes, Systems Analyst Copyright © 2015 Equinox Limited
About Equinox IT is New Zealand’s leading independent IT consultancy, delivering software development, consulting and training services. Established in 1995, we inject fresh thinking to solve tough business problems. Equinox IT has over 60 staff based in Wellington and Auckland. Copyright © 2015 Equinox Limited
Journey from Tester to Analyst Copyright © 2015 Equinox Limited 3
The tester, simplified • Test one thing at a time • A poor test triggers multiple failure states • Enter a credit card with an invalid date and no card holder details Copyright © 2015 Equinox Limited 4
The analyst, simplified • Describe one thing at a time • A poor requirement muddies the distinction between features • The system must be responsive Copyright © 2015 Equinox Limited 5
Finding common ground • Increase focus on early collaboration • Analysis of a requirement taking the form of a test case Copyright © 2015 Equinox Limited 6
Specification by Example basics Copyright © 2015 Equinox Limited 7
Why Specification by Example • A way to explicitly discuss assumptions and drive out actual requirements • Just one approach Copyright © 2015 Equinox Limited 8
Why Specification by Example • The earlier a problem is found, the cheaper it is to resolve Relative cost to fix 16 14 12 10 8 6 4 2 0 Design Implementation Testing Phase Defect is found Data sourced from IBM Systems Sciences Institute Copyright © 2015 Equinox Limited 9
Acronym Driven Development BDD Behaviour Driven Development FDD Feature-Driven Development ATDD Acceptance Test Driven Development Images sourced from freepik. com Copyright © 2015 Equinox Limited 10
What is Specification by Example? • Realistic examples over abstract statements • A collaborative approach • A facilitated approach Copyright © 2015 Equinox Limited 11
How Specification by Example can help • “We need to give people something complete enough to complain about” • Business Analysts can get caught in a world where they can never be wrong – which leads to them becoming a bottleneck Copyright © 2015 Equinox Limited 12
Specification by Example approaches • Table • Can be similar to decision tables in format • Scenarios • Given / When / Then format • Can be similar to business rules in format Copyright © 2015 Equinox Limited 13
Specification by Example approaches • Table, useful for describing inputs and outputs Order total ESA member? Free shipping? $10 M Yes $10 M No Yes $5 M No No Copyright © 2015 Equinox Limited 14
Specification by Example approaches • Scenario, useful for work flows Given I have logged in Preconditions And I have add an item to a consignment Trigger When I select to proceed to checkout Then the items will be listed for confirmation Outcomes And I am prompted to select a payment method Copyright © 2015 Equinox Limited 15
Specification by Example – How it Fits in. Copyright © 2015 Equinox Limited 16
How to use Specification by Example • BABOK – 7. 2. 4 Quality conditions for a requirement: • • • Atomic Complete Consistent Concise Feasible • • Unambiguous Testable Understandable Prioritised Copyright © 2015 Equinox Limited 17
Which approach when? • Table • If it’s a calculation • If showing the impact of one on many • Given / When / Then • If a table would be too big or complex • If you are describing a flow Copyright © 2015 Equinox Limited 18
Using Specification by Example: Practical Examples Copyright © 2015 Equinox Limited 19
Calculations – The Bad Way Given that an order has been made by a new customer When the price of the order is over $20 Then a discount of $5 is applied Given that an order has been made by a new customer When the price of the order is over $100 Then a discount of $33. 33 is applied Copyright © 2015 Equinox Limited 20
Calculations - Instead try: Customer Type Value of Order Discount New Customer >$20 25% New Customer >$100 33% Existing Customer >$20 0% Existing Customer >$100 10% Copyright © 2015 Equinox Limited 21
Tangled Table – The Bad Way Credit card name Credit card expiry Credit card number Credit card type Accepted? A Jones 12/15 1234 -1234 -1234 Visa Yes K Smith 1/17 2345 -2345 -2345 Amex No G Williams 4/16 18954254 Visa No R Penfold 8/15 3456 -3456 -3456 Master Card No M Matthews 2/16 123456789 GE Card No P Andrews 10/15 9876 -H 582 -G 156 -K 157 Visa No D Mc. Donald 11/14 CRED-ITCA-RDSS-UCK! No Amex Copyright © 2015 Equinox Limited 22
Tangled Table – Instead Try: Given that a credit card has been provided for payment When the credit card is valid Then the payment will be accepted Valid is defined as: - Having a name that is accepted by the credit card service - Having an expiry date that is equal to or after the current month - Having a number that: - - Consists entirely of numerals Is 16 characters long Contains 4 sets of sequential numbers Is of a type that is either Master. Card or Visa Copyright © 2015 Equinox Limited 23
Non-Atomic Given / When / Then – The Bad Way Given that a purchase has been submitted When the purchase has been validated and accepted Then send the customer the details of the order AND update the stock inventory AND send the information to the warehouse for fulfilment Copyright © 2015 Equinox Limited 24
Non-Atomic Given / When / Then Instead Try: Given that a purchase has been submitted When the purchase has been validated and accepted Then send the customer the details of the order Given that a purchase has been submitted When the purchase has been validated and accepted Then update the stock inventory Given that a purchase has been submitted When the purchase has been validated and accepted Then send the information to the warehouse for fulfilment Copyright © 2015 Equinox Limited 25
Multiple versions of input result in the same output – The Bad Way Item type Quantity Result Rocket Ship >1 Accept Spacesuit >1 Accept Space Helmet >1 Accept Space Rocks >1 Accept Space Boots >1 Accept Space Food >1 Accept Gravity Belt >1 Accept Anti-matter Ray >1 Accept Copyright © 2015 Equinox Limited 26
Multiple versions of input result in the same output - Instead Try: Given that a quantity of items have been requested When Validating the quantity Then numbers greater than one (1) are accepted Copyright © 2015 Equinox Limited 27
Quantities – whole numbers vs partial. The Bad Way Quantity requested Result 1 Accept 1. 1 Fail 1. 75 Fail -2 Fail 3. 89 Fail 1, 000 Accept 3, 768, 825. 976 Fail 0. 876328 Fail Copyright © 2015 Equinox Limited 28
Quantities – whole numbers vs partial Instead Try: Given that a quantity of rocketships have been requested When Validating the quantity Then only positive whole numbers can be accepted Given that a quantity of rocketships have been requested When the quantity is not a positive whole number Then display an error Copyright © 2015 Equinox Limited 29
Injecting fresh thinking to solve tough business problems. Copyright © 2015 Equinox Limited 30
- Slides: 30