SlideShare a Scribd company logo
1 of 41
Download to read offline
Test Driven Development
      met Flow en Neos




zondag 4 november 12
Rens Admiraal
                                 Flow / Neos core developer

                                 @renst3
                                 rens.admiraal@typo3.org



                                                      Inspiring people to
    http://tinyurl.com/9j4uhj3                        share
zondag 4 november 12
Demo package




       git clone --recursive git://github.com/radmiraal/Flow-and-Neos-Testing.git
       cd Flow-and-Neos-Testing
       curl -s https://getcomposer.org/installer | php
       php composer.phar install --dev




                                                                      Inspiring people to
    http://tinyurl.com/9j4uhj3                                        share
zondag 4 november 12
Bekendheid met testen




           100% coverage en CI!
           in control, goede coverage
           starten goed, houden niet bij
           te weinig, helaas...
           ... tests?



                                           Inspiring people to
    http://tinyurl.com/9j4uhj3             share
zondag 4 november 12
Crap in === crap out



              Ontwerp
              Developers
              Klant              Eindproduct
              Tools
              ...



                                   Inspiring people to
    http://tinyurl.com/9j4uhj3     share
zondag 4 november 12
Team Profiel - De enthousiaste developer


                                 Yeah, nieuw
                                   project!




                                                Inspiring people to
    http://tinyurl.com/9j4uhj3                  share
zondag 4 november 12
Team Profiel - De enthousiaste developer




                                 Lekker vaartje!




                                                   Inspiring people to
    http://tinyurl.com/9j4uhj3                     share
zondag 4 november 12
Team Profiel - De enthousiaste developer


                       Eeeh, waar ben ik?




                                                Inspiring people to
    http://tinyurl.com/9j4uhj3                  share
zondag 4 november 12
Team Profiel - De enthousiaste developer

                                                Ooeeeeeei!




                                                 Inspiring people to
    http://tinyurl.com/9j4uhj3                   share
zondag 4 november 12
Team Profiel - De enthousiaste developer




                                                Inspiring people to
    http://tinyurl.com/9j4uhj3                  share
zondag 4 november 12
Team Profiel - De bouwer




                                 Inspiring people to
    http://tinyurl.com/9j4uhj3   share
zondag 4 november 12
Team Profiel - De bouwer




                                 Inspiring people to
    http://tinyurl.com/9j4uhj3   share
zondag 4 november 12
Team Profiel - De bouwer




                                 Inspiring people to
    http://tinyurl.com/9j4uhj3   share
zondag 4 november 12
Team Profiel - De bouwer




                                 Inspiring people to
    http://tinyurl.com/9j4uhj3   share
zondag 4 november 12
Klant - De vrek




                                 Inspiring people to
    http://tinyurl.com/9j4uhj3   share
zondag 4 november 12
Klant - De vrek




                                 Inspiring people to
    http://tinyurl.com/9j4uhj3   share
zondag 4 november 12
Test Driven Development?


           Schrijf eerst test === denk eerst
           Snelste weg naar slagende test
           Refactor later




                                               Inspiring people to
    http://tinyurl.com/9j4uhj3                 share
zondag 4 november 12
Test Driven Development Quotes




          “Cease dependence on mass inspection to achieve quality.
          Improve the process and build quality into the product in
                              the first place.”




                                                     Inspiring people to
    http://tinyurl.com/9j4uhj3                       share
zondag 4 november 12
PHP Code Testen


           Flow testing framework gebruikt PHPUnit
           BaseTest class biedt helpers
           Configuratie standaard aanwezig
           Unit & Functionele tests




                                              Inspiring people to
    http://tinyurl.com/9j4uhj3                share
zondag 4 november 12
Tests Uitvoeren


           Unit tests:
           phpunit -c Build/buildessentials/PhpUnit/UnitTests.xml


           Functionele tests:
           phpunit -c Build/buildessentials/PhpUnit/FunctionalTests.xml




                                                             Inspiring people to
    http://tinyurl.com/9j4uhj3                               share
zondag 4 november 12
Unit / Functional tests


           Een unit test...
              test een class buiten zijn context
              test kleine ‘units’ code

           Een functionele test...
              test de class in zijn context
              tests dekken het volledige systeem


                                                   Inspiring people to
    http://tinyurl.com/9j4uhj3                     share
zondag 4 november 12
UnitTestCase Helpers


           Mock objecten
            getAccessibleMock()
            getAccessibleMockForAbstractClass()
           Dependency Injection
            inject()
           Protected / private
              _set()
              _call()
                                      Inspiring people to
    http://tinyurl.com/9j4uhj3        share
zondag 4 november 12
Dependency Injection


           Gebruik injection method indien mogelijk
               $mockFoo->injectBar($mockBar);
           inject()
             $this->inject($mockFoo, ‘bar’, $mockBar);
           AccessibleMock
             $mockFoo->_set(‘bar’, $mockBar);




                                                Inspiring people to
    http://tinyurl.com/9j4uhj3                  share
zondag 4 november 12
FunctionalTestCase


           $testableSecurityEnabled
           $testableHttpEnabled
           $router
           $testablePersistenceEnabled
           $browser
           $objectManager


                                         Inspiring people to
    http://tinyurl.com/9j4uhj3           share
zondag 4 november 12
Persistence Test



       /**
        * @test
        */
       public function aBlogCanBeCreatedAndPersisted() {
            $blog = new TYPO3T3CONTestDomainModelBlog();
            $blog->setTitle('foo');
            $this->blogRepository->add($blog);

              $this->persistenceManager->persistAll();
              $this->persistenceManager->clearState();

              $this->assertEquals(1, $this->blogRepository->countAll());
       }




                                                                           Inspiring people to
    http://tinyurl.com/9j4uhj3                                             share
zondag 4 november 12
HTTP Test



       /**
         * @test
         */
       public function getControllerObjectNameIsEmptyIfNoRouteMatchesCurrentRequest() {
             $this->router = new TYPO3FlowMvcRoutingRouter();
             $request = TYPO3FlowHttpRequest::create(
                 new TYPO3FlowHttpUri('http://localhost')
             );
             $actionRequest = $this->router->route($request);
             $this->assertEquals('', $actionRequest->getControllerObjectName());
       }




                                                                             Inspiring people to
    http://tinyurl.com/9j4uhj3                                               share
zondag 4 november 12
Security Test
       /**
        * @test
        */
       public function administratorsAreAllowedToSeeHiddenRestrictableEntities() {
            $this->authenticateRoles(array('Administrator'));

              $defaultEntity = new FixturesRestrictableEntity('default');
              $hiddenEntity = new FixturesRestrictableEntity('hiddenEntity');
              $hiddenEntity->setHidden(TRUE);

              // ...

              $result = $this->restrictableEntityRepository->findAll();
              $this->assertTrue(count($result) === 2);

              $this->assertNotNull($this->persistenceManager
                  ->getObjectByIdentifier($defaultEntityIdentifier,
                  'TYPO3T3CONTestTestsFunctionalSecurityFixturesRestrictableEntity'));
              $this->assertNotNull($this->persistenceManager
                  ->getObjectByIdentifier($hiddenEntityIdentifier,
                  'TYPO3T3CONTestTestsFunctionalSecurityFixturesRestrictableEntity'));

              $this->restrictableEntityRepository->removeAll();
              $this->persistenceManager->persistAll();
              $this->persistenceManager->clearState();
       }


                                                                                 Inspiring people to
    http://tinyurl.com/9j4uhj3                                                   share
zondag 4 november 12
“Browser” Test


       /**
        * @test
        */
       public function formIsRedisplayedIfValidationErrorsOccur() {
            $this->browser->request('http://localhost/test/fluid/formobjects’);
            $form = $this->browser->getForm();

              $form['post']['email']->setValue('test_noValidEmail');

              $this->browser->submit($form);
              $form = $this->browser->getForm();
              $this->assertSame('test_noValidEmail', $form['post']['email']->getValue());
              $this->assertSame('f3-form-error', $this->browser->getCrawler()
                  ->filterXPath('//*[@id="email"]')->attr('class'));

              $form['post']['email']->setValue('another@email.org');

              $response = $this->browser->submit($form);
              $this->assertSame('Egon Olsen|another@email.org', $response->getContent());
       }




                                                                                Inspiring people to
    http://tinyurl.com/9j4uhj3                                                  share
zondag 4 november 12
Test runner demo movie




       TODO




                                 Inspiring people to
    http://tinyurl.com/9j4uhj3   share
zondag 4 november 12
Test Driven Development Quotes




                       “During writing my tests, I recognize most of the
                                  flaws in my initial design.”




                                                              Inspiring people to
    http://tinyurl.com/9j4uhj3                                share
zondag 4 november 12
JavaScript Testen

                                            ...
                                                          QUnit
                         Jasmine
                                        JSTestDriver                      ...

                       JsUnit         ...
                                                           ...
                                YUI Test
         ...
                                                  Behat

                                                             Inspiring people to
    http://tinyurl.com/9j4uhj3                               share
zondag 4 november 12
Vereisten


           Compatible met Flow folder structuur
           Compatible met requirejs
           Headless testrunner
           XML rapporten
           ‘Multi browser’ tests



                                                  Inspiring people to
    http://tinyurl.com/9j4uhj3                    share
zondag 4 november 12
Buster.js


           Browser attaching
           Resource publishing
           AMD Support
           Meerdere ‘reporters’
           Headless testing (Phantomjs)


           Nog beta, wel serieuze activiteit
                                               Inspiring people to
    http://tinyurl.com/9j4uhj3                 share
zondag 4 november 12
Requirejs


       var requireConfiguration = requireConfiguration || {};
       requireConfiguration['TYPO3.T3CON.Test'] = {
            baseUrl: buster.env.contextPath + '/Web/_Resources/Static/Packages/',
            paths: {
                 'emberjs-lib': 'TYPO3.T3CON.Test/Library/emberjs/ember-0.9.7.min',
                 'jquery': 'TYPO3.T3CON.Test/JavaScript/jquery',
                 'emberjs': 'TYPO3.T3CON.Test/JavaScript/emberjs',
                 'queue': 'TYPO3.T3CON.Test/JavaScript/queue'
            },
            shim: {
                 'emberjs-lib': ['jquery'],
                 'queue': ['jquery']
            }
       };




      @see Tests/JavaScript/Unit/testcase.js


                                                                              Inspiring people to
    http://tinyurl.com/9j4uhj3                                                share
zondag 4 november 12
Test Syntax


           Testcases
            assertions
            expectations
           BDD




                                 Inspiring people to
    http://tinyurl.com/9j4uhj3   share
zondag 4 november 12
Meerdere browsers tegelijkertijd testen
       Successfully connected Phantomjs
       PhantomJS 1.7.0, OS X: ........
       Opera 12.02, OS X:     ........
       Safari 6.0.1, OS X:    ........
       Firefox 15.0.1, OS X: ........
       12 test cases, 32 tests, 140 assertions, 0 failures, 0 errors, 0 timeouts
       Finished in 0.047s




                                                                             Inspiring people to
    http://tinyurl.com/9j4uhj3                                               share
zondag 4 november 12
Test runner demo movie




       TODO




                                 Inspiring people to
    http://tinyurl.com/9j4uhj3   share
zondag 4 november 12
Test Driven Development Quotes




          “Mijn bug reproduceren met een test? Kan dat? Maar... dan
                     kan ik dus regressions voorkomen!”




                                                     Inspiring people to
    http://tinyurl.com/9j4uhj3                       share
zondag 4 november 12
Continues Integration




                                 Inspiring people to
    http://tinyurl.com/9j4uhj3   share
zondag 4 november 12
Tests uitvoeren met Jenkins


           Gerrit trigger op patches
           Unit tests (evt. functioneel)
           Resultaat post op IRC




                                           Inspiring people to
    http://tinyurl.com/9j4uhj3             share
zondag 4 november 12
presentationShouldBePrepared()


                            presentationShouldBeGiven()


                                 questionsShouldBeAnswered()




                                                        Inspiring people to
    http://tinyurl.com/9j4uhj3                          share
zondag 4 november 12

More Related Content

Similar to TYPO3 Congres 2012 - Test-Driven Development binnen TYPO3 Flow en Neos

Puppet Camp Berlin 2014: Advanced Puppet Design
Puppet Camp Berlin 2014: Advanced Puppet DesignPuppet Camp Berlin 2014: Advanced Puppet Design
Puppet Camp Berlin 2014: Advanced Puppet DesignPuppet
 
Sustainable TDD
Sustainable TDDSustainable TDD
Sustainable TDDSteven Mak
 
Objects, Testing, and Responsibility
Objects, Testing, and ResponsibilityObjects, Testing, and Responsibility
Objects, Testing, and Responsibilitymachuga
 
Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)benwaine
 
Puppet modules: A Holistic Approach - Geneva
Puppet modules: A Holistic Approach - GenevaPuppet modules: A Holistic Approach - Geneva
Puppet modules: A Holistic Approach - GenevaAlessandro Franceschi
 
Writing jQuery that doesn't suck - London jQuery
Writing jQuery that doesn't suck - London jQueryWriting jQuery that doesn't suck - London jQuery
Writing jQuery that doesn't suck - London jQueryRoss Bruniges
 
De vuelta al pasado con SQL y stored procedures
De vuelta al pasado con SQL y stored proceduresDe vuelta al pasado con SQL y stored procedures
De vuelta al pasado con SQL y stored proceduresNorman Clarke
 
WordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldWordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldDrewAPicture
 
Building Reusable Puppet Modules
Building Reusable Puppet ModulesBuilding Reusable Puppet Modules
Building Reusable Puppet ModulesPuppet
 
WordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldWordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldDrewAPicture
 
PHPUnit best practices presentation
PHPUnit best practices presentationPHPUnit best practices presentation
PHPUnit best practices presentationThanh Robi
 
Writing your own augeasproviders
Writing your own augeasprovidersWriting your own augeasproviders
Writing your own augeasprovidersDominic Cleal
 
The Solar Framework for PHP
The Solar Framework for PHPThe Solar Framework for PHP
The Solar Framework for PHPConFoo
 
A Big Look at MiniTest
A Big Look at MiniTestA Big Look at MiniTest
A Big Look at MiniTestMark
 
Intro to Angular.JS Directives
Intro to Angular.JS DirectivesIntro to Angular.JS Directives
Intro to Angular.JS DirectivesChristian Lilley
 
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013cordoval
 
Evolve your toolchains dev/ops with OpenStack
Evolve your toolchains dev/ops with OpenStackEvolve your toolchains dev/ops with OpenStack
Evolve your toolchains dev/ops with OpenStackRyan Richard
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkJeremy Kendall
 

Similar to TYPO3 Congres 2012 - Test-Driven Development binnen TYPO3 Flow en Neos (20)

Puppet Camp Berlin 2014: Advanced Puppet Design
Puppet Camp Berlin 2014: Advanced Puppet DesignPuppet Camp Berlin 2014: Advanced Puppet Design
Puppet Camp Berlin 2014: Advanced Puppet Design
 
Sustainable TDD
Sustainable TDDSustainable TDD
Sustainable TDD
 
Objects, Testing, and Responsibility
Objects, Testing, and ResponsibilityObjects, Testing, and Responsibility
Objects, Testing, and Responsibility
 
Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)
 
Script it
Script itScript it
Script it
 
Puppet modules: A Holistic Approach - Geneva
Puppet modules: A Holistic Approach - GenevaPuppet modules: A Holistic Approach - Geneva
Puppet modules: A Holistic Approach - Geneva
 
Writing jQuery that doesn't suck - London jQuery
Writing jQuery that doesn't suck - London jQueryWriting jQuery that doesn't suck - London jQuery
Writing jQuery that doesn't suck - London jQuery
 
De vuelta al pasado con SQL y stored procedures
De vuelta al pasado con SQL y stored proceduresDe vuelta al pasado con SQL y stored procedures
De vuelta al pasado con SQL y stored procedures
 
WordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldWordPress Development in a Modern PHP World
WordPress Development in a Modern PHP World
 
Building Reusable Puppet Modules
Building Reusable Puppet ModulesBuilding Reusable Puppet Modules
Building Reusable Puppet Modules
 
WordPress Development in a Modern PHP World
WordPress Development in a Modern PHP WorldWordPress Development in a Modern PHP World
WordPress Development in a Modern PHP World
 
PHPUnit best practices presentation
PHPUnit best practices presentationPHPUnit best practices presentation
PHPUnit best practices presentation
 
Writing your own augeasproviders
Writing your own augeasprovidersWriting your own augeasproviders
Writing your own augeasproviders
 
The Solar Framework for PHP
The Solar Framework for PHPThe Solar Framework for PHP
The Solar Framework for PHP
 
A Big Look at MiniTest
A Big Look at MiniTestA Big Look at MiniTest
A Big Look at MiniTest
 
Intro to Angular.JS Directives
Intro to Angular.JS DirectivesIntro to Angular.JS Directives
Intro to Angular.JS Directives
 
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
Specking Interactors with PHPSpec and YOLO (DDD) at PHPConference Argentina 2013
 
Evolve your toolchains dev/ops with OpenStack
Evolve your toolchains dev/ops with OpenStackEvolve your toolchains dev/ops with OpenStack
Evolve your toolchains dev/ops with OpenStack
 
Building Custom PHP Extensions
Building Custom PHP ExtensionsBuilding Custom PHP Extensions
Building Custom PHP Extensions
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro framework
 

More from TYPO3 Nederland

TYPO3 Congres 2012 - Keynote: A day with TYPO3
TYPO3 Congres 2012 - Keynote: A day with TYPO3TYPO3 Congres 2012 - Keynote: A day with TYPO3
TYPO3 Congres 2012 - Keynote: A day with TYPO3TYPO3 Nederland
 
TYPO3 Congres 2012 - TYPO3 voor klantgerichte bedrijfsprocessen
TYPO3 Congres 2012 - TYPO3 voor klantgerichte bedrijfsprocessenTYPO3 Congres 2012 - TYPO3 voor klantgerichte bedrijfsprocessen
TYPO3 Congres 2012 - TYPO3 voor klantgerichte bedrijfsprocessenTYPO3 Nederland
 
TYPO3 Congres 2012 - Cookiewet: alles wat je wilde weten, maar niet durfde te...
TYPO3 Congres 2012 - Cookiewet: alles wat je wilde weten, maar niet durfde te...TYPO3 Congres 2012 - Cookiewet: alles wat je wilde weten, maar niet durfde te...
TYPO3 Congres 2012 - Cookiewet: alles wat je wilde weten, maar niet durfde te...TYPO3 Nederland
 
TYPO3 Congres 2012 - Wat komt er kijken bij een TYPO3 CMS in een gemeentelijk...
TYPO3 Congres 2012 - Wat komt er kijken bij een TYPO3 CMS in een gemeentelijk...TYPO3 Congres 2012 - Wat komt er kijken bij een TYPO3 CMS in een gemeentelijk...
TYPO3 Congres 2012 - Wat komt er kijken bij een TYPO3 CMS in een gemeentelijk...TYPO3 Nederland
 
TYPO3 Congres 2012 - TYPO3 als centraal documentatiesysteem
TYPO3 Congres 2012 - TYPO3 als centraal documentatiesysteemTYPO3 Congres 2012 - TYPO3 als centraal documentatiesysteem
TYPO3 Congres 2012 - TYPO3 als centraal documentatiesysteemTYPO3 Nederland
 
TYPO3 Congres 2012 - Klant Contact Systeem met TYPO3 en Verseon Zaaksysteem
TYPO3 Congres 2012 - Klant Contact Systeem met TYPO3 en Verseon ZaaksysteemTYPO3 Congres 2012 - Klant Contact Systeem met TYPO3 en Verseon Zaaksysteem
TYPO3 Congres 2012 - Klant Contact Systeem met TYPO3 en Verseon ZaaksysteemTYPO3 Nederland
 
TYPO3 Congres 2012 - Hoe kreeg Leiden haar 3 sterren?
TYPO3 Congres 2012 - Hoe kreeg Leiden haar 3 sterren?TYPO3 Congres 2012 - Hoe kreeg Leiden haar 3 sterren?
TYPO3 Congres 2012 - Hoe kreeg Leiden haar 3 sterren?TYPO3 Nederland
 
TYPO3 Congres 2012 - EO: van 120 sites naar 1 portal
TYPO3 Congres 2012 - EO: van 120 sites naar 1 portalTYPO3 Congres 2012 - EO: van 120 sites naar 1 portal
TYPO3 Congres 2012 - EO: van 120 sites naar 1 portalTYPO3 Nederland
 
TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 1/2
TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 1/2TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 1/2
TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 1/2TYPO3 Nederland
 
TYPO3 Congres 2012 - Praktische toepassingen van geodata binnen het TYPO3 CMS
TYPO3 Congres 2012 - Praktische toepassingen van geodata binnen het TYPO3 CMSTYPO3 Congres 2012 - Praktische toepassingen van geodata binnen het TYPO3 CMS
TYPO3 Congres 2012 - Praktische toepassingen van geodata binnen het TYPO3 CMSTYPO3 Nederland
 
TYPO3 Congres 2012 - Sony on TYPO3: Rapid Global Deployment Case Study
TYPO3 Congres 2012 - Sony on TYPO3: Rapid Global Deployment Case StudyTYPO3 Congres 2012 - Sony on TYPO3: Rapid Global Deployment Case Study
TYPO3 Congres 2012 - Sony on TYPO3: Rapid Global Deployment Case StudyTYPO3 Nederland
 
TYPO3 Congres 2012 - Bouw je eerste site met TYPO3 Neos
TYPO3 Congres 2012 - Bouw je eerste site met TYPO3 NeosTYPO3 Congres 2012 - Bouw je eerste site met TYPO3 Neos
TYPO3 Congres 2012 - Bouw je eerste site met TYPO3 NeosTYPO3 Nederland
 
TYPO3 Congres 2012 - Introductie werken met CSS preprocessors
TYPO3 Congres 2012 - Introductie werken met CSS preprocessorsTYPO3 Congres 2012 - Introductie werken met CSS preprocessors
TYPO3 Congres 2012 - Introductie werken met CSS preprocessorsTYPO3 Nederland
 
TYPO3 Congres 2012 - Aan de slag met TYPO3 Extbase en Fluid
TYPO3 Congres 2012 - Aan de slag met TYPO3 Extbase en FluidTYPO3 Congres 2012 - Aan de slag met TYPO3 Extbase en Fluid
TYPO3 Congres 2012 - Aan de slag met TYPO3 Extbase en FluidTYPO3 Nederland
 
TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 2/2
TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 2/2TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 2/2
TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 2/2TYPO3 Nederland
 
TYPO3 Congres 2012 - Responsive webdesign
TYPO3 Congres 2012 - Responsive webdesignTYPO3 Congres 2012 - Responsive webdesign
TYPO3 Congres 2012 - Responsive webdesignTYPO3 Nederland
 
TYPO3 Congres 2011 - Rens Admiraal - FLOW3 en TYPO3 PHOENIX
TYPO3 Congres 2011 - Rens Admiraal - FLOW3 en TYPO3 PHOENIXTYPO3 Congres 2011 - Rens Admiraal - FLOW3 en TYPO3 PHOENIX
TYPO3 Congres 2011 - Rens Admiraal - FLOW3 en TYPO3 PHOENIXTYPO3 Nederland
 
TYPO3 Congres 2011 - Patrick Broens - FORM
TYPO3 Congres 2011 - Patrick Broens - FORMTYPO3 Congres 2011 - Patrick Broens - FORM
TYPO3 Congres 2011 - Patrick Broens - FORMTYPO3 Nederland
 
TYPO3 Congres 2011 - ROQUIN - PhpStorm
TYPO3 Congres 2011 - ROQUIN - PhpStormTYPO3 Congres 2011 - ROQUIN - PhpStorm
TYPO3 Congres 2011 - ROQUIN - PhpStormTYPO3 Nederland
 

More from TYPO3 Nederland (20)

Hooks
HooksHooks
Hooks
 
TYPO3 Congres 2012 - Keynote: A day with TYPO3
TYPO3 Congres 2012 - Keynote: A day with TYPO3TYPO3 Congres 2012 - Keynote: A day with TYPO3
TYPO3 Congres 2012 - Keynote: A day with TYPO3
 
TYPO3 Congres 2012 - TYPO3 voor klantgerichte bedrijfsprocessen
TYPO3 Congres 2012 - TYPO3 voor klantgerichte bedrijfsprocessenTYPO3 Congres 2012 - TYPO3 voor klantgerichte bedrijfsprocessen
TYPO3 Congres 2012 - TYPO3 voor klantgerichte bedrijfsprocessen
 
TYPO3 Congres 2012 - Cookiewet: alles wat je wilde weten, maar niet durfde te...
TYPO3 Congres 2012 - Cookiewet: alles wat je wilde weten, maar niet durfde te...TYPO3 Congres 2012 - Cookiewet: alles wat je wilde weten, maar niet durfde te...
TYPO3 Congres 2012 - Cookiewet: alles wat je wilde weten, maar niet durfde te...
 
TYPO3 Congres 2012 - Wat komt er kijken bij een TYPO3 CMS in een gemeentelijk...
TYPO3 Congres 2012 - Wat komt er kijken bij een TYPO3 CMS in een gemeentelijk...TYPO3 Congres 2012 - Wat komt er kijken bij een TYPO3 CMS in een gemeentelijk...
TYPO3 Congres 2012 - Wat komt er kijken bij een TYPO3 CMS in een gemeentelijk...
 
TYPO3 Congres 2012 - TYPO3 als centraal documentatiesysteem
TYPO3 Congres 2012 - TYPO3 als centraal documentatiesysteemTYPO3 Congres 2012 - TYPO3 als centraal documentatiesysteem
TYPO3 Congres 2012 - TYPO3 als centraal documentatiesysteem
 
TYPO3 Congres 2012 - Klant Contact Systeem met TYPO3 en Verseon Zaaksysteem
TYPO3 Congres 2012 - Klant Contact Systeem met TYPO3 en Verseon ZaaksysteemTYPO3 Congres 2012 - Klant Contact Systeem met TYPO3 en Verseon Zaaksysteem
TYPO3 Congres 2012 - Klant Contact Systeem met TYPO3 en Verseon Zaaksysteem
 
TYPO3 Congres 2012 - Hoe kreeg Leiden haar 3 sterren?
TYPO3 Congres 2012 - Hoe kreeg Leiden haar 3 sterren?TYPO3 Congres 2012 - Hoe kreeg Leiden haar 3 sterren?
TYPO3 Congres 2012 - Hoe kreeg Leiden haar 3 sterren?
 
TYPO3 Congres 2012 - EO: van 120 sites naar 1 portal
TYPO3 Congres 2012 - EO: van 120 sites naar 1 portalTYPO3 Congres 2012 - EO: van 120 sites naar 1 portal
TYPO3 Congres 2012 - EO: van 120 sites naar 1 portal
 
TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 1/2
TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 1/2TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 1/2
TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 1/2
 
TYPO3 Congres 2012 - Praktische toepassingen van geodata binnen het TYPO3 CMS
TYPO3 Congres 2012 - Praktische toepassingen van geodata binnen het TYPO3 CMSTYPO3 Congres 2012 - Praktische toepassingen van geodata binnen het TYPO3 CMS
TYPO3 Congres 2012 - Praktische toepassingen van geodata binnen het TYPO3 CMS
 
TYPO3 Congres 2012 - Sony on TYPO3: Rapid Global Deployment Case Study
TYPO3 Congres 2012 - Sony on TYPO3: Rapid Global Deployment Case StudyTYPO3 Congres 2012 - Sony on TYPO3: Rapid Global Deployment Case Study
TYPO3 Congres 2012 - Sony on TYPO3: Rapid Global Deployment Case Study
 
TYPO3 Congres 2012 - Bouw je eerste site met TYPO3 Neos
TYPO3 Congres 2012 - Bouw je eerste site met TYPO3 NeosTYPO3 Congres 2012 - Bouw je eerste site met TYPO3 Neos
TYPO3 Congres 2012 - Bouw je eerste site met TYPO3 Neos
 
TYPO3 Congres 2012 - Introductie werken met CSS preprocessors
TYPO3 Congres 2012 - Introductie werken met CSS preprocessorsTYPO3 Congres 2012 - Introductie werken met CSS preprocessors
TYPO3 Congres 2012 - Introductie werken met CSS preprocessors
 
TYPO3 Congres 2012 - Aan de slag met TYPO3 Extbase en Fluid
TYPO3 Congres 2012 - Aan de slag met TYPO3 Extbase en FluidTYPO3 Congres 2012 - Aan de slag met TYPO3 Extbase en Fluid
TYPO3 Congres 2012 - Aan de slag met TYPO3 Extbase en Fluid
 
TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 2/2
TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 2/2TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 2/2
TYPO3 Congres 2012 - Intranet voor medewerkers en door medewerkers 2/2
 
TYPO3 Congres 2012 - Responsive webdesign
TYPO3 Congres 2012 - Responsive webdesignTYPO3 Congres 2012 - Responsive webdesign
TYPO3 Congres 2012 - Responsive webdesign
 
TYPO3 Congres 2011 - Rens Admiraal - FLOW3 en TYPO3 PHOENIX
TYPO3 Congres 2011 - Rens Admiraal - FLOW3 en TYPO3 PHOENIXTYPO3 Congres 2011 - Rens Admiraal - FLOW3 en TYPO3 PHOENIX
TYPO3 Congres 2011 - Rens Admiraal - FLOW3 en TYPO3 PHOENIX
 
TYPO3 Congres 2011 - Patrick Broens - FORM
TYPO3 Congres 2011 - Patrick Broens - FORMTYPO3 Congres 2011 - Patrick Broens - FORM
TYPO3 Congres 2011 - Patrick Broens - FORM
 
TYPO3 Congres 2011 - ROQUIN - PhpStorm
TYPO3 Congres 2011 - ROQUIN - PhpStormTYPO3 Congres 2011 - ROQUIN - PhpStorm
TYPO3 Congres 2011 - ROQUIN - PhpStorm
 

Recently uploaded

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 

Recently uploaded (20)

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 

TYPO3 Congres 2012 - Test-Driven Development binnen TYPO3 Flow en Neos

  • 1. Test Driven Development met Flow en Neos zondag 4 november 12
  • 2. Rens Admiraal Flow / Neos core developer @renst3 rens.admiraal@typo3.org Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 3. Demo package git clone --recursive git://github.com/radmiraal/Flow-and-Neos-Testing.git cd Flow-and-Neos-Testing curl -s https://getcomposer.org/installer | php php composer.phar install --dev Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 4. Bekendheid met testen 100% coverage en CI! in control, goede coverage starten goed, houden niet bij te weinig, helaas... ... tests? Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 5. Crap in === crap out Ontwerp Developers Klant Eindproduct Tools ... Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 6. Team Profiel - De enthousiaste developer Yeah, nieuw project! Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 7. Team Profiel - De enthousiaste developer Lekker vaartje! Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 8. Team Profiel - De enthousiaste developer Eeeh, waar ben ik? Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 9. Team Profiel - De enthousiaste developer Ooeeeeeei! Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 10. Team Profiel - De enthousiaste developer Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 11. Team Profiel - De bouwer Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 12. Team Profiel - De bouwer Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 13. Team Profiel - De bouwer Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 14. Team Profiel - De bouwer Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 15. Klant - De vrek Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 16. Klant - De vrek Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 17. Test Driven Development? Schrijf eerst test === denk eerst Snelste weg naar slagende test Refactor later Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 18. Test Driven Development Quotes “Cease dependence on mass inspection to achieve quality. Improve the process and build quality into the product in the first place.” Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 19. PHP Code Testen Flow testing framework gebruikt PHPUnit BaseTest class biedt helpers Configuratie standaard aanwezig Unit & Functionele tests Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 20. Tests Uitvoeren Unit tests: phpunit -c Build/buildessentials/PhpUnit/UnitTests.xml Functionele tests: phpunit -c Build/buildessentials/PhpUnit/FunctionalTests.xml Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 21. Unit / Functional tests Een unit test... test een class buiten zijn context test kleine ‘units’ code Een functionele test... test de class in zijn context tests dekken het volledige systeem Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 22. UnitTestCase Helpers Mock objecten getAccessibleMock() getAccessibleMockForAbstractClass() Dependency Injection inject() Protected / private _set() _call() Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 23. Dependency Injection Gebruik injection method indien mogelijk $mockFoo->injectBar($mockBar); inject() $this->inject($mockFoo, ‘bar’, $mockBar); AccessibleMock $mockFoo->_set(‘bar’, $mockBar); Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 24. FunctionalTestCase $testableSecurityEnabled $testableHttpEnabled $router $testablePersistenceEnabled $browser $objectManager Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 25. Persistence Test /** * @test */ public function aBlogCanBeCreatedAndPersisted() { $blog = new TYPO3T3CONTestDomainModelBlog(); $blog->setTitle('foo'); $this->blogRepository->add($blog); $this->persistenceManager->persistAll(); $this->persistenceManager->clearState(); $this->assertEquals(1, $this->blogRepository->countAll()); } Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 26. HTTP Test /** * @test */ public function getControllerObjectNameIsEmptyIfNoRouteMatchesCurrentRequest() { $this->router = new TYPO3FlowMvcRoutingRouter(); $request = TYPO3FlowHttpRequest::create( new TYPO3FlowHttpUri('http://localhost') ); $actionRequest = $this->router->route($request); $this->assertEquals('', $actionRequest->getControllerObjectName()); } Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 27. Security Test /** * @test */ public function administratorsAreAllowedToSeeHiddenRestrictableEntities() { $this->authenticateRoles(array('Administrator')); $defaultEntity = new FixturesRestrictableEntity('default'); $hiddenEntity = new FixturesRestrictableEntity('hiddenEntity'); $hiddenEntity->setHidden(TRUE); // ... $result = $this->restrictableEntityRepository->findAll(); $this->assertTrue(count($result) === 2); $this->assertNotNull($this->persistenceManager ->getObjectByIdentifier($defaultEntityIdentifier, 'TYPO3T3CONTestTestsFunctionalSecurityFixturesRestrictableEntity')); $this->assertNotNull($this->persistenceManager ->getObjectByIdentifier($hiddenEntityIdentifier, 'TYPO3T3CONTestTestsFunctionalSecurityFixturesRestrictableEntity')); $this->restrictableEntityRepository->removeAll(); $this->persistenceManager->persistAll(); $this->persistenceManager->clearState(); } Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 28. “Browser” Test /** * @test */ public function formIsRedisplayedIfValidationErrorsOccur() { $this->browser->request('http://localhost/test/fluid/formobjects’); $form = $this->browser->getForm(); $form['post']['email']->setValue('test_noValidEmail'); $this->browser->submit($form); $form = $this->browser->getForm(); $this->assertSame('test_noValidEmail', $form['post']['email']->getValue()); $this->assertSame('f3-form-error', $this->browser->getCrawler() ->filterXPath('//*[@id="email"]')->attr('class')); $form['post']['email']->setValue('another@email.org'); $response = $this->browser->submit($form); $this->assertSame('Egon Olsen|another@email.org', $response->getContent()); } Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 29. Test runner demo movie TODO Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 30. Test Driven Development Quotes “During writing my tests, I recognize most of the flaws in my initial design.” Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 31. JavaScript Testen ... QUnit Jasmine JSTestDriver ... JsUnit ... ... YUI Test ... Behat Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 32. Vereisten Compatible met Flow folder structuur Compatible met requirejs Headless testrunner XML rapporten ‘Multi browser’ tests Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 33. Buster.js Browser attaching Resource publishing AMD Support Meerdere ‘reporters’ Headless testing (Phantomjs) Nog beta, wel serieuze activiteit Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 34. Requirejs var requireConfiguration = requireConfiguration || {}; requireConfiguration['TYPO3.T3CON.Test'] = { baseUrl: buster.env.contextPath + '/Web/_Resources/Static/Packages/', paths: { 'emberjs-lib': 'TYPO3.T3CON.Test/Library/emberjs/ember-0.9.7.min', 'jquery': 'TYPO3.T3CON.Test/JavaScript/jquery', 'emberjs': 'TYPO3.T3CON.Test/JavaScript/emberjs', 'queue': 'TYPO3.T3CON.Test/JavaScript/queue' }, shim: { 'emberjs-lib': ['jquery'], 'queue': ['jquery'] } }; @see Tests/JavaScript/Unit/testcase.js Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 35. Test Syntax Testcases assertions expectations BDD Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 36. Meerdere browsers tegelijkertijd testen Successfully connected Phantomjs PhantomJS 1.7.0, OS X: ........ Opera 12.02, OS X: ........ Safari 6.0.1, OS X: ........ Firefox 15.0.1, OS X: ........ 12 test cases, 32 tests, 140 assertions, 0 failures, 0 errors, 0 timeouts Finished in 0.047s Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 37. Test runner demo movie TODO Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 38. Test Driven Development Quotes “Mijn bug reproduceren met een test? Kan dat? Maar... dan kan ik dus regressions voorkomen!” Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 39. Continues Integration Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 40. Tests uitvoeren met Jenkins Gerrit trigger op patches Unit tests (evt. functioneel) Resultaat post op IRC Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12
  • 41. presentationShouldBePrepared() presentationShouldBeGiven() questionsShouldBeAnswered() Inspiring people to http://tinyurl.com/9j4uhj3 share zondag 4 november 12