Designing Functional Tests

Designing Functional Tests

How to design functional tests to catch problems before your customers do.

Presented at PHP Surrey on 3rd Feb 2016.

2c1dc90ff7bf69097a151677624777d2?s=128

Stuart Herbert

February 03, 2016
Tweet

Transcript

  1. 14.
  2. 22.

    Logic User Database Network Logic Logic Network UI & API

    UI & API UI & API Local Storage Local Storage Local Storage
  3. 23.

    @GanbaroDigital Break Down Your App • User interface & API

    • Processing logic • Anything stored on the local machine
  4. 24.

    Logic User Database Network Logic Logic Network UI & API

    UI & API UI & API Local Storage Local Storage Local Storage
  5. 27.

    Logic User Database Network Logic Logic Network UI & API

    UI & API UI & API Local Storage Local Storage Local Storage
  6. 31.

    Logic User Database Network Logic Logic Network UI & API

    UI & API UI & API Local Storage Local Storage Local Storage
  7. 36.
  8. 38.

    @GanbaroDigital The effectiveness of BDD testing is inversely proportional to

    the number of moving parts in your app’s architecture.
  9. 39.

    @GanbaroDigital BDD testing cares that 
 something can be done.

    Functional tests care that 
 something has been done 
 accurately & completely.
  10. 40.

    @GanbaroDigital BDD testing cares that 
 something can be done.

    Functional tests care that 
 something has been done 
 accurately & completely.
  11. 44.

    Logic Database Network Logic Logic Network UI & API UI

    & API UI & API Local Storage Local Storage Local Storage User
  12. 45.

    Logic Database Network Logic Logic Network UI & API UI

    & API UI & API Local Storage Local Storage Local Storage Actor
  13. 48.

    Logic Database Network Logic Logic Network UI & API UI

    & API UI & API Local Storage Local Storage Local Storage Actor
  14. 53.

    @GanbaroDigital For example: 
 if your actor uses a web

    browser, the functional test 
 must use a web browser.
  15. 59.

    @GanbaroDigital For example: 
 if your actor uses 
 a

    specific client library, the functional test must use the same client library.
  16. 64.

    Logic Database Network Logic Logic Network UI & API UI

    & API UI & API Local Storage Local Storage Local Storage Actor
  17. 66.

    Logic Database Network Logic Logic Network UI & API UI

    & API UI & API Local Storage Local Storage Local Storage Actor
  18. 71.

    @GanbaroDigital For example: if your UI says payment has been

    taken, has the purchase been stored in your database?
  19. 74.

    @GanbaroDigital Functional Tests • Start from a defined state •

    Perform one operation • Use the same tools as the actor • Result in another defined state • Prove that the target state is achieved
  20. 75.

    @GanbaroDigital Functional Tests • Start from a defined state •

    Perform one operation • Use the same tools as the actor • Result in another defined state • Prove that the target state is achieved
  21. 76.

    @GanbaroDigital Functional Tests • Start from a defined state •

    Perform one operation • Use the same tools as the actor • Result in another defined state • Prove that the target state is achieved
  22. 77.

    @GanbaroDigital Functional Tests • Start from a defined state •

    Perform one operation • Use the same tools as the actor • Result in another defined state • Prove that the target state is achieved
  23. 78.

    @GanbaroDigital Functional Tests • Start from a defined state •

    Perform one operation • Use the same tools as the actor • Result in another defined state • Prove that the target state is achieved
  24. 82.

    @GanbaroDigital Functional Tests • Start from a defined state •

    Perform one operation • Use the same tools as the actor • Result in another defined state • Prove that the target state is achieved
  25. 83.

    @GanbaroDigital Wording A Functional Test • “Given <starting conditions>” •

    “Using <specific tool>” • “As <specific actor>” • “When I do <specific operation>” • “A <long list of things> happen” • “And I can now do 
 <a list of other things>”
  26. 84.

    @GanbaroDigital Wording A Functional Test • “Given <starting conditions>” •

    “Using <specific tool>” • “As <specific actor>” • “When I do <specific operation>” • “A <long list of things> happen” • “And I can now do 
 <a list of other things>”
  27. 85.

    @GanbaroDigital Wording A Functional Test • “Given <starting conditions>” •

    “Using <specific tool>” • “As <specific actor>” • “When I do <specific operation>” • “A <long list of things> happen” • “And I can now do 
 <a list of other things>”
  28. 86.

    @GanbaroDigital Wording A Functional Test • “Given <starting conditions>” •

    “Using <specific tool>” • “As <specific actor>” • “When I do <specific operation>” • “A <long list of things> happen” • “And I can now do 
 <a list of other things>”
  29. 87.

    Logic Database Network Logic Logic Network UI & API UI

    & API UI & API Local Storage Local Storage Local Storage Actor
  30. 88.

    @GanbaroDigital Wording A Functional Test • “Given <starting conditions>” •

    “Using <specific tool>” • “As <specific actor>” • “When I do <specific operation>” • “A <long list of things> happen” • “And I can now do 
 <a list of other things>”
  31. 89.

    Logic Database Network Logic Logic Network UI & API UI

    & API UI & API Local Storage Local Storage Local Storage Actor
  32. 90.

    @GanbaroDigital Wording A Functional Test • “Given <starting conditions>” •

    “Using <specific tool>” • “As <specific actor>” • “When I do <specific operation>” • “A <long list of things> happen” • “And I can now do 
 <a list of other things>”
  33. 92.

    @GanbaroDigital As A Code Flow • Test setup • Pre-test

    inspection • Action(s) • Post-test inspection • Test tear down
  34. 93.

    @GanbaroDigital As A Code Flow • Test setup • Pre-test

    inspection • Action(s) • Post-test inspection • Test tear down
  35. 94.

    @GanbaroDigital As A Code Flow • Test setup • Pre-test

    inspection • Action(s) • Post-test inspection • Test tear down
  36. 95.

    @GanbaroDigital As A Code Flow • Test setup • Pre-test

    inspection • Action(s) • Post-test inspection • Test tear down
  37. 96.

    @GanbaroDigital As A Code Flow • Test setup • Pre-test

    inspection • Action(s) • Post-test inspection • Test tear down
  38. 105.

    Would you like to 
 know more? We can help.

    Stuart Herbert ~ @stuherbert Founder @GanbaroDigital