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

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Recently uploaded (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

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