the key to move really fast – lightning talk | niclas nilsson | ltg-43/dtg-7
TRANSCRIPT
ATM exampleFeature: Cash withdrawal In order to get money when the bank is closed As an Account Holder I want to withdraw cash from an ATM
Scenario: Account has sufficient funds Given the account balance is 100 And the card is valid And the machine contains enough money When the account holder requests 20 Then the ATM should dispense 20
Not just happy casesScenario: Account has insufficient funds Given the account balance is 10 And the card is valid And the machine contains enough money When the account holder requests 20 Then the ATM should not dispense any money And the ATM should say there are insufficient funds And the account balance should be 10 And the card should be returned Scenario: Card has been disabled Given the card is disabled When the account holder requests 20 Then the ATM should retain the card
Features in plain textFeature: Cash withdrawal In order to get money when the bank is closed As an Account Holder I want to withdraw cash from an ATM
Scenario: Account has sufficient funds Given the account balance is 100 And the card is valid And the machine contains enough money When the account holder requests 20 Then the ATM should dispense 20
Not just happy casesScenario: Account has insufficient funds Given the account balance is 10 And the card is valid And the machine contains enough money When the account holder requests 20 Then the ATM should not dispense any money And the ATM should say there are insufficient funds And the account balance should be 10 And the card should be returned Scenario: Card has been disabled Given the card is disabled When the account holder requests 20 Then the ATM should retain the card
Features in plain textFeature: Cash withdrawal In order to get money when the bank is closed As an Account Holder I want to withdraw cash from an ATM
Scenario: Account has sufficient funds Given the account balance is 100 And the card is valid And the machine contains enough money When the account holder requests 20 Then the ATM should dispense 20
Unit testsCovers smaller units/componentsFast execution timesVery technicalGood for complex algorithmsGood for reusable components
Acceptance testsCovers slices of the complete systemSlower execution timesIntentionalGood for the complete systemGood for avoiding complex/subtle integration bugsProvides a holistic safety net
How to have the cookie and eat it too:The feature specs should always hold.But you can have multiple sets of step definitions- Full scale, including UI and DB- Lighter and faster, no UI, no DBNote: The same feature specs - different step impls!