SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Downloaden Sie, um offline zu lesen
Unit Testing




                        Raymond Muilwijk
                        Michel van de Ven
                           Madcap BV




http://open.madcap.nl                       http://www.madcap.nl
Agenda
●   De theorie
    ●   Wat zijn unit tests?
    ●   Wat heb je er aan?
    ●   Test-first programming
    ●   Pointers and pitfalls
●   De praktijk
    ●   Demonstratie unit tests & refactoring, test-first
        programming
    ●   Toekomst van simpletest
●   Q&A
Wat zijn unit tests?
●   Doel is verificatie en validatie:
    Bouwen we het systeem juist?
    Bouwen we het juiste systeem?
●   In code geformuleerde tests die, in een
    bekende context, “units” van het systeem
    functioneel testen.
    (Unit = functie, module, class &c)
●   Voorspelbaar, reproduceerbaar.
●   Programmer Tests & Customer Tests,
    integratietest
Wat heb je er aan? (1)
●   Write once, use forever: zinvolle investering.
●   Levende systeemdocumentatie: samen met de
    code onderhouden, dus actueel.
●   Controle op regressie van bugs: iedere bug zijn
    eigen unit test.
●   Courage to change: geen onvermoede
    effecten.
●   Hulp bij impactanalyse: Wat is de fan-out als ik
    deze interface verander?
Wat heb je er aan? (2)
●   Werkt toepassen van gezonde software
    engineering principes in de hand:
    ●   Functionele decompositie.
    ●   Decoupling & isolation, reduceren afhankelijkheden.
    ●   MVC, Law of Demeter, YAGNI, DRY.
●   Voorwaarde voor het kunnen doen van
    refactoring.
●   Kwaliteit.
Test-first programming
●   Eerst de test, dan pas de code.
●   Unit test is zeer precieze want in code
    geformuleerde specificatie.
●   Belangrijke effecten:
    ●   Het formuleren van de unit test dwingt tot het doen
        van analyse en ontwerp (JIT, XP)
    ●   Je kunt stoppen met coderen precies wanneer de
        unit test slaagt.
        Do the simplest thing that could possibly work.
        You are not going to need it.
Pointers & Pitfalls
●   Unit tests tonen, net als alle andere methoden,
    alleen de aanwezigheid van bugs aan, niet de
    afwezigheid.
●   De code van de unit test kan net zo buggy zijn
    als het testonderwerp.
●   Unit tests moeten tezamen met de code
    onderhouden worden.
●   Hoeveel unit tests moet je maken?
    Test everything that can possibly break.
●   Gebruik van revisie controle is voorwaarde.
Drupaljam Testing 20090626
Demo
Voorbereiding
  CVS checkout: http://drupal.org/node/320

  Testcase maken: http://drupal.org/node/325974

Refactoring
  Convert search module: http://drupal.org/node/394182

Test First

Interesting

  What's next: http://buytaert.net/drupal-7-testing-status-update-and-next-steps

  PIFR: http://testing.drupal.org/pifr/status
Q&A

Weitere ähnliche Inhalte

Andere mochten auch

Ontwikkelen van online platformen met Drupal 8
Ontwikkelen van online platformen met Drupal 8Ontwikkelen van online platformen met Drupal 8
Ontwikkelen van online platformen met Drupal 8Raymond Muilwijk
 
Multimediagebruik in Drupal 7 met de Media module
Multimediagebruik in Drupal 7 met de Media module Multimediagebruik in Drupal 7 met de Media module
Multimediagebruik in Drupal 7 met de Media module Raymond Muilwijk
 
Agile Test Driven Development
Agile Test Driven DevelopmentAgile Test Driven Development
Agile Test Driven DevelopmentViraf Karai
 
Reinventing Organizations - Frederic Laloux
Reinventing Organizations - Frederic LalouxReinventing Organizations - Frederic Laloux
Reinventing Organizations - Frederic LalouxHet Eerste Huis
 
Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)Brian Rasmussen
 

Andere mochten auch (6)

Ontwikkelen van online platformen met Drupal 8
Ontwikkelen van online platformen met Drupal 8Ontwikkelen van online platformen met Drupal 8
Ontwikkelen van online platformen met Drupal 8
 
Multimediagebruik in Drupal 7 met de Media module
Multimediagebruik in Drupal 7 met de Media module Multimediagebruik in Drupal 7 met de Media module
Multimediagebruik in Drupal 7 met de Media module
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 
Agile Test Driven Development
Agile Test Driven DevelopmentAgile Test Driven Development
Agile Test Driven Development
 
Reinventing Organizations - Frederic Laloux
Reinventing Organizations - Frederic LalouxReinventing Organizations - Frederic Laloux
Reinventing Organizations - Frederic Laloux
 
Test-Driven Development (TDD)
Test-Driven Development (TDD)Test-Driven Development (TDD)
Test-Driven Development (TDD)
 

Ähnlich wie Drupaljam Testing 20090626

Testen in de transitie naar continuous delivery
Testen in de transitie naar continuous deliveryTesten in de transitie naar continuous delivery
Testen in de transitie naar continuous deliveryXebia Nederland BV
 
Kader & Belang van testen - dS+V Gemeente Rotterdam
Kader & Belang van testen - dS+V Gemeente RotterdamKader & Belang van testen - dS+V Gemeente Rotterdam
Kader & Belang van testen - dS+V Gemeente RotterdamEwald Roodenrijs
 
Introductie at framework
Introductie at frameworkIntroductie at framework
Introductie at frameworkErwin Heitzman
 
Romex intro test no animation
Romex intro test no animationRomex intro test no animation
Romex intro test no animationPeter van Oostrom
 
Experience Story: Implementing Test automation in your organization
Experience Story: Implementing Test automation in your organizationExperience Story: Implementing Test automation in your organization
Experience Story: Implementing Test automation in your organizationDerk-Jan de Grood
 
Continuous delivery met jenkins twist en puppet
Continuous delivery met jenkins twist en puppetContinuous delivery met jenkins twist en puppet
Continuous delivery met jenkins twist en puppetltebbens
 
Meetup at SIG: Meten is weten
Meetup at SIG: Meten is wetenMeetup at SIG: Meten is weten
Meetup at SIG: Meten is wetenDevnology
 
Workshop BI/DWH AGILE TESTING SNS Bank Dutch
Workshop BI/DWH AGILE TESTING SNS Bank DutchWorkshop BI/DWH AGILE TESTING SNS Bank Dutch
Workshop BI/DWH AGILE TESTING SNS Bank DutchMarcus Drost
 
Tussentijdse presentatie 22/11/2012
Tussentijdse presentatie 22/11/2012Tussentijdse presentatie 22/11/2012
Tussentijdse presentatie 22/11/2012Tim Ameye
 
ING : How top quality software and state-of-the-art technology leads to conti...
ING : How top quality software and state-of-the-art technology leads to conti...ING : How top quality software and state-of-the-art technology leads to conti...
ING : How top quality software and state-of-the-art technology leads to conti...NLJUG
 
Workshop BI/DWH AGILE TESTING Zwitserleven Dutch
Workshop BI/DWH AGILE TESTING Zwitserleven DutchWorkshop BI/DWH AGILE TESTING Zwitserleven Dutch
Workshop BI/DWH AGILE TESTING Zwitserleven DutchMarcus Drost
 
Lean PRINCE2, projectmanagement is waste (maar noodzakelijk)
Lean PRINCE2, projectmanagement is waste (maar noodzakelijk)Lean PRINCE2, projectmanagement is waste (maar noodzakelijk)
Lean PRINCE2, projectmanagement is waste (maar noodzakelijk)Martin van Borselaer
 
Hoe releasen minder pijnlijk werd bij de ANWB Alarmcentrale
Hoe releasen minder pijnlijk werd bij de ANWB AlarmcentraleHoe releasen minder pijnlijk werd bij de ANWB Alarmcentrale
Hoe releasen minder pijnlijk werd bij de ANWB AlarmcentraleSjoerd Hemminga
 
Techdays 2012 - Better code through reviews and tools
Techdays 2012 - Better code through reviews and toolsTechdays 2012 - Better code through reviews and tools
Techdays 2012 - Better code through reviews and toolsJesse Houwing
 
Niet onderhoudbare software in 10 makkelijke stappen
Niet onderhoudbare software in 10 makkelijke stappenNiet onderhoudbare software in 10 makkelijke stappen
Niet onderhoudbare software in 10 makkelijke stappenRick Beerendonk
 
Agile software ontwikkeling met continuous delivery
Agile software ontwikkeling met continuous deliveryAgile software ontwikkeling met continuous delivery
Agile software ontwikkeling met continuous deliveryWillem Meints
 
Hands-off performance testing - Twan Koot & Addy Zwiebel
Hands-off performance testing - Twan Koot & Addy ZwiebelHands-off performance testing - Twan Koot & Addy Zwiebel
Hands-off performance testing - Twan Koot & Addy ZwiebelSogeti Nederland B.V.
 

Ähnlich wie Drupaljam Testing 20090626 (20)

Testen in de transitie naar continuous delivery
Testen in de transitie naar continuous deliveryTesten in de transitie naar continuous delivery
Testen in de transitie naar continuous delivery
 
Integratiefase
IntegratiefaseIntegratiefase
Integratiefase
 
Kader & Belang van testen - dS+V Gemeente Rotterdam
Kader & Belang van testen - dS+V Gemeente RotterdamKader & Belang van testen - dS+V Gemeente Rotterdam
Kader & Belang van testen - dS+V Gemeente Rotterdam
 
Introductie at framework
Introductie at frameworkIntroductie at framework
Introductie at framework
 
Romex intro test no animation
Romex intro test no animationRomex intro test no animation
Romex intro test no animation
 
Experience Story: Implementing Test automation in your organization
Experience Story: Implementing Test automation in your organizationExperience Story: Implementing Test automation in your organization
Experience Story: Implementing Test automation in your organization
 
Agile - De Rol Van Tester
Agile - De Rol Van TesterAgile - De Rol Van Tester
Agile - De Rol Van Tester
 
Continuous delivery met jenkins twist en puppet
Continuous delivery met jenkins twist en puppetContinuous delivery met jenkins twist en puppet
Continuous delivery met jenkins twist en puppet
 
Meetup at SIG: Meten is weten
Meetup at SIG: Meten is wetenMeetup at SIG: Meten is weten
Meetup at SIG: Meten is weten
 
Workshop BI/DWH AGILE TESTING SNS Bank Dutch
Workshop BI/DWH AGILE TESTING SNS Bank DutchWorkshop BI/DWH AGILE TESTING SNS Bank Dutch
Workshop BI/DWH AGILE TESTING SNS Bank Dutch
 
H6 Realisatiefase
H6 RealisatiefaseH6 Realisatiefase
H6 Realisatiefase
 
Tussentijdse presentatie 22/11/2012
Tussentijdse presentatie 22/11/2012Tussentijdse presentatie 22/11/2012
Tussentijdse presentatie 22/11/2012
 
ING : How top quality software and state-of-the-art technology leads to conti...
ING : How top quality software and state-of-the-art technology leads to conti...ING : How top quality software and state-of-the-art technology leads to conti...
ING : How top quality software and state-of-the-art technology leads to conti...
 
Workshop BI/DWH AGILE TESTING Zwitserleven Dutch
Workshop BI/DWH AGILE TESTING Zwitserleven DutchWorkshop BI/DWH AGILE TESTING Zwitserleven Dutch
Workshop BI/DWH AGILE TESTING Zwitserleven Dutch
 
Lean PRINCE2, projectmanagement is waste (maar noodzakelijk)
Lean PRINCE2, projectmanagement is waste (maar noodzakelijk)Lean PRINCE2, projectmanagement is waste (maar noodzakelijk)
Lean PRINCE2, projectmanagement is waste (maar noodzakelijk)
 
Hoe releasen minder pijnlijk werd bij de ANWB Alarmcentrale
Hoe releasen minder pijnlijk werd bij de ANWB AlarmcentraleHoe releasen minder pijnlijk werd bij de ANWB Alarmcentrale
Hoe releasen minder pijnlijk werd bij de ANWB Alarmcentrale
 
Techdays 2012 - Better code through reviews and tools
Techdays 2012 - Better code through reviews and toolsTechdays 2012 - Better code through reviews and tools
Techdays 2012 - Better code through reviews and tools
 
Niet onderhoudbare software in 10 makkelijke stappen
Niet onderhoudbare software in 10 makkelijke stappenNiet onderhoudbare software in 10 makkelijke stappen
Niet onderhoudbare software in 10 makkelijke stappen
 
Agile software ontwikkeling met continuous delivery
Agile software ontwikkeling met continuous deliveryAgile software ontwikkeling met continuous delivery
Agile software ontwikkeling met continuous delivery
 
Hands-off performance testing - Twan Koot & Addy Zwiebel
Hands-off performance testing - Twan Koot & Addy ZwiebelHands-off performance testing - Twan Koot & Addy Zwiebel
Hands-off performance testing - Twan Koot & Addy Zwiebel
 

Drupaljam Testing 20090626

  • 1. Unit Testing Raymond Muilwijk Michel van de Ven Madcap BV http://open.madcap.nl http://www.madcap.nl
  • 2. Agenda ● De theorie ● Wat zijn unit tests? ● Wat heb je er aan? ● Test-first programming ● Pointers and pitfalls ● De praktijk ● Demonstratie unit tests & refactoring, test-first programming ● Toekomst van simpletest ● Q&A
  • 3. Wat zijn unit tests? ● Doel is verificatie en validatie: Bouwen we het systeem juist? Bouwen we het juiste systeem? ● In code geformuleerde tests die, in een bekende context, “units” van het systeem functioneel testen. (Unit = functie, module, class &c) ● Voorspelbaar, reproduceerbaar. ● Programmer Tests & Customer Tests, integratietest
  • 4. Wat heb je er aan? (1) ● Write once, use forever: zinvolle investering. ● Levende systeemdocumentatie: samen met de code onderhouden, dus actueel. ● Controle op regressie van bugs: iedere bug zijn eigen unit test. ● Courage to change: geen onvermoede effecten. ● Hulp bij impactanalyse: Wat is de fan-out als ik deze interface verander?
  • 5. Wat heb je er aan? (2) ● Werkt toepassen van gezonde software engineering principes in de hand: ● Functionele decompositie. ● Decoupling & isolation, reduceren afhankelijkheden. ● MVC, Law of Demeter, YAGNI, DRY. ● Voorwaarde voor het kunnen doen van refactoring. ● Kwaliteit.
  • 6. Test-first programming ● Eerst de test, dan pas de code. ● Unit test is zeer precieze want in code geformuleerde specificatie. ● Belangrijke effecten: ● Het formuleren van de unit test dwingt tot het doen van analyse en ontwerp (JIT, XP) ● Je kunt stoppen met coderen precies wanneer de unit test slaagt. Do the simplest thing that could possibly work. You are not going to need it.
  • 7. Pointers & Pitfalls ● Unit tests tonen, net als alle andere methoden, alleen de aanwezigheid van bugs aan, niet de afwezigheid. ● De code van de unit test kan net zo buggy zijn als het testonderwerp. ● Unit tests moeten tezamen met de code onderhouden worden. ● Hoeveel unit tests moet je maken? Test everything that can possibly break. ● Gebruik van revisie controle is voorwaarde.
  • 9. Demo Voorbereiding CVS checkout: http://drupal.org/node/320 Testcase maken: http://drupal.org/node/325974 Refactoring Convert search module: http://drupal.org/node/394182 Test First Interesting What's next: http://buytaert.net/drupal-7-testing-status-update-and-next-steps PIFR: http://testing.drupal.org/pifr/status
  • 10. Q&A