Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Application Quality

Application Quality

Joint presentation of Marijus Kilmanas and me on application quality with Behat and Phpspec.

Demo code: https://github.com/asarturas/bdd-demo-petition-website
Demo video (without commentaries): https://www.dropbox.com/sh/bmru6po6khybv0p/QaLfyLL8-h?lst

Arturas Smorgun

October 16, 2013
Tweet

More Decks by Arturas Smorgun

Other Decks in Programming

Transcript

  1. Application Quality What is it? How to create it? How

    to maintain it? Why should I care? @ KaunasPHP v.7
  2. Why are we here? • Because quality matters; • Because

    we care about the reputation of our craft and the craftsmen; • Because there is a way to sleep calm at night.
  3. Are we responsible? • We are professionals • quality is

    expected • We are craftsmen • we should do our job to the best • Quality = recommendation • trust of customers
  4. Why we need tests? • Refactoring without tests is... •

    Pain • Insane • Suicide • Refucktoring ...
  5. Let’s speak Gherkin! In order to cooperate As developers /

    agency We need to have a common language • States the business value; • Defines the beneficiary; • Gives an idea of what is needed to achieve value.
  6. Scenario: Customer understands Gherkin Given I produce feature specification When

    customer reads them Then they should understand what we agree upon • Lists assumptions and preconditions; • Defines what action triggers the behavior; • Tells how to verify if behavior was correct; Let’s speak Gherkin!
  7. Scenario: Gherkin can be tested Given customer confirmed the feature

    When when we implement them Then we should be able to verify they conform to the agreed requirements • Defines exactly how much functionality is needed; • Automates acceptance criteria; • Guides development process; Let’s speak Gherkin!
  8. Mink Webdrivers • Goutte (headless) • Selenium (full browser) •

    Selenium2 (modern selenium) • Sahi (selenium on JS) • Zombie.js (headless JS browser) • Phantom.js (headless JS browser)
  9. Sessions • Used within a single scenario; • Represents state

    of the browser; • Page object is a sub-property; • Allows different browser for separate scenarios.
  10. Motivation • Wo do make mistakes; • Integration testing is

    expensive; • Testing afterwards is boring; • “Test last” encourages to skip it; • We want to code, not to debug.
  11. What TDD is not: • It’s not about verifying; •

    It’s not about “waterfall”; • It’s not for fast hacks.
  12. What TDD is: • It’s about communication; • It’s about

    being agile; • It’s for long term relationships.
  13. 3 rules of TDD: • Do not write production code

    unless there is failing test; • Do not write more test than it is sufficient to fail; • Do not write more production code than it is sufficient to pass failing test.
  14. Problems? • A lot of scaffolding have to be done

    in order to write test; • Mocking is expensive (time = money); • Misleading terminology.
  15. TDD ⇾ BDD • Test Case ⇾ Specification • Test

    ⇾ Example • Assertion ⇾ Expectation
  16. PhpSpec • Easy to use: • does boring stuff for

    you; • mocking & stubbing is very easy; • TDD cycle oriented; • Behavior oriented: • encourages specification by example.
  17. Doubles • Dummy • Fake • Mock • Stub •

    Spy ←Control indirect output ←Messaging ←No behavior
  18. “Live” Demo • Code: • https://github.com/asarturas/bdd- demo-petition-website • Video (without

    commentaries, sorry): • https://www.dropbox.com/sh/ bmru6po6khybv0p/QaLfyLL8-h#/
  19. Inviqa provides training • on Professional PHP and OOD •

    on Agile development • on collaborative BDD approach • on full stack BDD in use • on git & git flow • and many more
  20. We are looking for team mates! Senior Software Engineers, passionate

    about their job. (but we mean it!) Kaunas, London, Liverpool, Sheffield, Manchester, Edinburgh, Leeds.