how to become a 'specification by example' rocket scientist
TRANSCRIPT
Copyright © 2015 Equinox Limited
How to become a 'specification by example' rocket scientist
Kirsten Eriksen, Senior ConsultantBen Hughes, Systems Analyst
Copyright © 2015 Equinox Limited
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.
About Equinox IT
Copyright © 2015 Equinox Limited 3
Journey from Tester to Analyst
Copyright © 2015 Equinox Limited 4
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 5
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 6
Finding common ground
• Increase focus on early collaboration
• Analysis of a requirement taking the form of a test case
Copyright © 2015 Equinox Limited 7
Specification by Example basics
Copyright © 2015 Equinox Limited 8
Why Specification by Example
• A way to explicitly discuss assumptions and drive out actual requirements
• Just one approach
Copyright © 2015 Equinox Limited 9
Why Specification by Example
• The earlier a problem is found, the cheaper it is to resolve
Design Implementation Testing0
2
4
6
8
10
12
14
16
Relative cost to fix
Phase Defect is foundData sourced from IBM Systems Sciences Institute
Copyright © 2015 Equinox Limited 10
Acronym Driven Development
Images sourced from freepik.com
ATDDAcceptance Test Driven Development
BDDBehaviour Driven Development
FDDFeature-Driven Development
Copyright © 2015 Equinox Limited 11
What is Specification by Example?
• Realistic examples over abstract statements
• A collaborative approach
• A facilitated approach
Copyright © 2015 Equinox Limited 12
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 13
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 14
Specification by Example approaches
• Table, useful for describing inputs and outputs
Order total ESA member? Free shipping?
$10M Yes Yes
$10M No Yes
$5M Yes Yes
$5M No No
Copyright © 2015 Equinox Limited 15
Specification by Example approaches
• Scenario, useful for work flows
Given I have logged inAnd I have add an item to a consignmentWhen I select to proceed to checkoutThen the items will be listed for confirmationAnd I am prompted to select a payment method
Preconditions
Trigger
Outcomes
Copyright © 2015 Equinox Limited 16
Specification by Example – How it Fits in.
Copyright © 2015 Equinox Limited 17
How to use Specification by Example
• Atomic• Complete• Consistent• Concise• Feasible
• Unambiguous• Testable• Understandable• Prioritised
• BABOK – 7.2.4 Quality conditions for a requirement:
Copyright © 2015 Equinox Limited 18
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 19
Using Specification by Example: Practical Examples
Copyright © 2015 Equinox Limited 20
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 21
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 22
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-1234 Visa Yes
K Smith 1/17 2345-2345-2345-2345 Amex No
G Williams 4/16 18954254 Visa No
R Penfold 8/15 3456-3456-3456-3456 Master Card No
M Matthews 2/16 123456789 GE Card No
P Andrews 10/15 9876-H582-G156-K157 Visa No
D McDonald 11/14 CRED-ITCA-RDSS-UCK! Amex No
Copyright © 2015 Equinox Limited 23
Tangled Table – Instead Try:
Given that a credit card has been provided for paymentWhen the credit card is validThen 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 MasterCard or Visa
Copyright © 2015 Equinox Limited 24
Non-Atomic Given / When / Then – The Bad Way
Given that a purchase has been submittedWhen the purchase has been validated and acceptedThen send the customer the details of the orderAND update the stock inventoryAND send the information to the warehouse for fulfilment
Copyright © 2015 Equinox Limited 25
Non-Atomic Given / When / ThenInstead Try:
Given that a purchase has been submittedWhen the purchase has been validated and acceptedThen send the customer the details of the order
Given that a purchase has been submittedWhen the purchase has been validated and acceptedThen update the stock inventory
Given that a purchase has been submittedWhen the purchase has been validated and acceptedThen send the information to the warehouse for fulfilment
Copyright © 2015 Equinox Limited 26
Multiple versions of input result in the same output – The Bad WayItem type Quantity Result
Rocket Ship >1 Accept
Spacesuit >1 Accept
Space Helmet >1 AcceptSpace Rocks >1 AcceptSpace Boots >1 AcceptSpace Food >1 AcceptGravity Belt >1 AcceptAnti-matter Ray >1 Accept
Copyright © 2015 Equinox Limited 27
Multiple versions of input result in the same output - Instead Try:
Given that a quantity of items have been requestedWhen Validating the quantityThen numbers greater than one (1) are accepted
Copyright © 2015 Equinox Limited 28
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,000 Accept
3,768,825.976 Fail
0.876328 Fail
Copyright © 2015 Equinox Limited 29
Quantities – whole numbers vs partialInstead Try: Given that a quantity of rocketships have been requestedWhen Validating the quantityThen only positive whole numbers can be accepted
Given that a quantity of rocketships have been requestedWhen the quantity is not a positive whole numberThen display an error
Copyright © 2015 Equinox Limited 30
Injecting fresh thinking to solve tough business problems.