SlideShare ist ein Scribd-Unternehmen logo
1 von 99
Test-Driven Development
for TYPO3




Oliver Klee, 2011-07-08
typo3-coding@oliverklee.de
Unit
tests?
Manual testing is cumbersome
Automated
testing is
fast
Unit tests for the
 Realty Manager
   extension
more than
1600 tests
in less than 60
    seconds
Verify that your code
does what you expect
Make sure that your
changes won‘t break
           anything
Keep
        other coders
from breaking your code
Don‘t break anything
even in complex projects
Create asafety net
   for refactoring
Green feels good!
Green feels good!
Know
   your
  tools
The phpunit extension
             has it all
The phpunit extension
               has it all
phpunit (TYPO3 extension)
The phpunit extension
               has it all
phpunit (TYPO3 extension)
 PHPUnit (PEAR package)
The phpunit extension
               has it all
phpunit (TYPO3 extension)
 PHPUnit (PEAR package)

 Testrunner
 (back-end-
  module)
The phpunit extension
               has it all
phpunit (TYPO3 extension)
 PHPUnit (PEAR package)

 Testrunner    Testrunner
 (back-end-
  module)     (CLI module)
The phpunit extension
               has it all
phpunit (TYPO3 extension)
 PHPUnit (PEAR package)
  Testing framework for FE & DB
 Testrunner         Testrunner
 (back-end-
  module)          (CLI module)
Let‘s get
some terms
  straight
Two tests
meet in a
  bar ...
Two tests
Test   meet in a
         bar ...
Two tests
  Test      meet in a
Assertion     bar ...
Two tests
  Test      meet in a
Assertion     bar ...
  Test
  Test
Two tests
  Test      meet in a
Assertion     bar ...
  Test
  Test
Test case
Two tests
  Test      meet in a
Assertion     bar ...
  Test
  Test
Test case
Test case
Two tests
  Test       meet in a
Assertion      bar ...
  Test
  Test
Test case
Test case
Test suite
The   life cycle unit test
               of a
The   life cycle unit test
               of a
The   life cycle unit test
               of a
                      new FooTest();
The   life cycle unit test
               of a
                      new FooTest();
The   life cycle unit test
               of a
                      new FooTest();

                           setUp();
The   life cycle unit test
               of a
                      new FooTest();

                           setUp();

                       /** @test */
                      lifeIsGood();
The   life cycle unit test
               of a
                      new FooTest();

                           setUp();

                       /** @test */
                      lifeIsGood();
The   life cycle unit test
               of a
                      new FooTest();

                           setUp();

                       /** @test */
                      lifeIsGood();

                        tearDown();
The   life cycle unit test
               of a
                      new FooTest();

                           setUp();

                       /** @test */
                      lifeIsGood();

                        tearDown();
The   life cycle unit test
               of a
                      new FooTest();

                           setUp();

                       /** @test */
                      lifeIsGood();

                        tearDown();
Use   meaningful
           unit test   names
Use   meaningful
                          unit test   names
Name the
behavior.            classCanBeInstantiated
Use   meaningful
                            unit test   names
 Name the
 behavior.             classCanBeInstantiated


Mention the
 method.                   setTitleSetsTitle
Use   meaningful
                                 unit test   names
  Name the
  behavior.                 classCanBeInstantiated


Mention the
 method.                         setTitleSetsTitle


  Name the          setSizeWithZeroThrowsException
preconditions.   hasTitleForEmptyTitleReturnsFalse
Use   meaningful
                                 unit test   names
  Name the
  behavior.                 classCanBeInstantiated


Mention the
 method.                         setTitleSetsTitle


  Name the          setSizeWithZeroThrowsException
preconditions.   hasTitleForEmptyTitleReturnsFalse


  Dont‘t use
 "works" or
 "correctly".
Use   meaningful
                                   unit test   names
  Name the
  behavior.                   classCanBeInstantiated


Mention the
 method.                           setTitleSetsTitle


  Name the          setSizeWithZeroThrowsException
preconditions.   hasTitleForEmptyTitleReturnsFalse


  Dont‘t use
 "works" or             measureFrubbleWorksCorrectly
 "correctly".
Use   meaningful
                                   unit test   names
  Name the
  behavior.                   classCanBeInstantiated


Mention the
 method.                           setTitleSetsTitle


  Name the          setSizeWithZeroThrowsException
preconditions.   hasTitleForEmptyTitleReturnsFalse


  Dont‘t use
 "works" or             measureFrubbleWorksCorrectly
 "correctly".
Code   test-first
Code   test-first
Code   test-first

write
test
Code   test-first

write
test
Code    test-first

write          write
test           code
Code    test-first

write          write
test           code
Code    test-first

write          write
test           code
Code    test-first

write          write
test           code



                       refactor
Code    test-first

write          write
test           code



                       refactor
There are
 small and huge
              tests
Unit tests are
        small and fast
Integration tests test
  the complete thing
Automated click tests
    test the interface
Automated click tests
    test the interface



              Selenium
Blackbox tests
       test
        the   public interface
Whitebox tests   test the
       inner workings
The   testing framework
                 is created quickly
	   /**
	    * @var Tx_Phpunit_Framework
	    */
	   protected $testingFramework = NULL;

	   public function setUp() {
	   	 $this->testingFramework = new Tx_Phpunit_Framework('tx_news2');
	   }

	   public function tearDown() {
	   	 $this->testingFramework->cleanUp();
	   	 unset($this->testingFramework);
	   }
The   testing framework
                 is created quickly
	   /**
	    * @var Tx_Phpunit_Framework
	    */
	   protected $testingFramework = NULL;

	   public function setUp() {
	   	 $this->testingFramework = new Tx_Phpunit_Framework('tx_news2');
	   }
                                                       discard the FE,
	   public function tearDown() {
                                                     delete DB records,
	   	 $this->testingFramework->cleanUp();
	   	 unset($this->testingFramework);
                                                         delete ïŹles
	   }
The   testing framework
                 is created quickly
	   /**
	    * @var Tx_Phpunit_Framework
	    */
	   protected $testingFramework = NULL;

	   public function setUp() {
	   	 $this->testingFramework = new Tx_Phpunit_Framework('tx_news2');
	   }
                                                       discard the FE,
	   public function tearDown() {
                                                     delete DB records,
	   	 $this->testingFramework->cleanUp();
	   	 unset($this->testingFramework);
                                                         delete ïŹles
	   }




CREATE TABLE tx_news2_domain_model_news (
	 

	 is_dummy_record tinyint(1) unsigned DEFAULT '0' NOT NULL,
	 

The   testing framework
              can fake almost everything
The   testing framework
              can fake almost everything
         $recordUid = $tf->createRecord($tableName, array $recordData = array());
The   testing framework
              can fake almost everything
         $recordUid = $tf->createRecord($tableName, array $recordData = array());

                          $tf->changeRecord($tableName, $uid, array $recordData);
The   testing framework
              can fake almost everything
         $recordUid = $tf->createRecord($tableName, array $recordData = array());

                          $tf->changeRecord($tableName, $uid, array $recordData);


                                             $tf->deleteRecord($tableName, $uid);
The   testing framework
              can fake almost everything
         $recordUid = $tf->createRecord($tableName, array $recordData = array());

                          $tf->changeRecord($tableName, $uid, array $recordData);


                                             $tf->deleteRecord($tableName, $uid);


           $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0);
The   testing framework
              can fake almost everything
             $recordUid = $tf->createRecord($tableName, array $recordData = array());

                              $tf->changeRecord($tableName, $uid, array $recordData);


                                                 $tf->deleteRecord($tableName, $uid);


               $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0);


$tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName);
The   testing framework
              can fake almost everything
             $recordUid = $tf->createRecord($tableName, array $recordData = array());

                              $tf->changeRecord($tableName, $uid, array $recordData);


                                                 $tf->deleteRecord($tableName, $uid);


               $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0);


$tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName);


                             $tf->removeRelation($tableName, $uidLocal, $uidForeign);
The   testing framework
              can fake almost everything
             $recordUid = $tf->createRecord($tableName, array $recordData = array());

                              $tf->changeRecord($tableName, $uid, array $recordData);


                                                 $tf->deleteRecord($tableName, $uid);


               $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0);


$tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName);


                             $tf->removeRelation($tableName, $uidLocal, $uidForeign);


                 $numberOfRecords = $tf->countRecords($tableName, $whereClause = '');
The   testing framework
              can fake almost everything
             $recordUid = $tf->createRecord($tableName, array $recordData = array());

                              $tf->changeRecord($tableName, $uid, array $recordData);


                                                 $tf->deleteRecord($tableName, $uid);


               $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0);


$tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName);


                             $tf->removeRelation($tableName, $uidLocal, $uidForeign);


                 $numberOfRecords = $tf->countRecords($tableName, $whereClause = '');


                         $success = $tf->existsRecord($tableName, $whereClause = '');
The   testing framework
              can fake almost everything
             $recordUid = $tf->createRecord($tableName, array $recordData = array());

                              $tf->changeRecord($tableName, $uid, array $recordData);


                                                 $tf->deleteRecord($tableName, $uid);


               $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0);


$tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName);


                             $tf->removeRelation($tableName, $uidLocal, $uidForeign);


                 $numberOfRecords = $tf->countRecords($tableName, $whereClause = '');


                         $success = $tf->existsRecord($tableName, $whereClause = '');


               $success = $tf->existsExactlyOneRecord($tableName, $whereClause = '');
The   testing framework
              can fake almost everything
             $recordUid = $tf->createRecord($tableName, array $recordData = array());

                              $tf->changeRecord($tableName, $uid, array $recordData);


                                                 $tf->deleteRecord($tableName, $uid);


               $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0);


$tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName);


                             $tf->removeRelation($tableName, $uidLocal, $uidForeign);


                 $numberOfRecords = $tf->countRecords($tableName, $whereClause = '');


                         $success = $tf->existsRecord($tableName, $whereClause = '');


               $success = $tf->existsExactlyOneRecord($tableName, $whereClause = '');


                              $success = $tf->existsRecordWithUid($tableName, $uid);
The   testing framework
              can fake almost everything
The   testing framework
              can fake almost everything
      $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());
The   testing framework
              can fake almost everything
      $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());


      $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array());
The   testing framework
              can fake almost everything
      $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());


      $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array());


 $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array());
The   testing framework
              can fake almost everything
      $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());


      $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array());


 $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array());


                          $tf->createTemplate($pageId, array $recordData = array());
The   testing framework
              can fake almost everything
      $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());


      $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array());


 $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array());


                          $tf->createTemplate($pageId, array $recordData = array());


                                   $pageUid = $tf->createFakeFrontEnd($pageUid = 0);
The   testing framework
              can fake almost everything
      $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());


      $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array());


 $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array());


                          $tf->createTemplate($pageId, array $recordData = array());


                                   $pageUid = $tf->createFakeFrontEnd($pageUid = 0);


                                                         $tf->discardFakeFrontEnd();
The   testing framework
              can fake almost everything
      $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());


      $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array());


 $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array());


                          $tf->createTemplate($pageId, array $recordData = array());


                                   $pageUid = $tf->createFakeFrontEnd($pageUid = 0);


                                                         $tf->discardFakeFrontEnd();


              $groupUid = $tf->createFrontEndUserGroup(array $recordData = array());
The   testing framework
              can fake almost everything
      $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());


      $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array());


 $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array());


                          $tf->createTemplate($pageId, array $recordData = array());


                                   $pageUid = $tf->createFakeFrontEnd($pageUid = 0);


                                                         $tf->discardFakeFrontEnd();


              $groupUid = $tf->createFrontEndUserGroup(array $recordData = array());


      $userUid = $tf->createFrontEndUser($groups = '', array $recordData = array());
The   testing framework
              can fake almost everything
      $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());


      $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array());


 $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array());


                          $tf->createTemplate($pageId, array $recordData = array());


                                   $pageUid = $tf->createFakeFrontEnd($pageUid = 0);


                                                         $tf->discardFakeFrontEnd();


              $groupUid = $tf->createFrontEndUserGroup(array $recordData = array());


      $userUid = $tf->createFrontEndUser($groups = '', array $recordData = array());


                                                    $tf->loginFrontEndUser($userId);
The   testing framework
              can fake almost everything
      $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());


      $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array());


 $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array());


                          $tf->createTemplate($pageId, array $recordData = array());


                                   $pageUid = $tf->createFakeFrontEnd($pageUid = 0);


                                                         $tf->discardFakeFrontEnd();


              $groupUid = $tf->createFrontEndUserGroup(array $recordData = array());


      $userUid = $tf->createFrontEndUser($groups = '', array $recordData = array());


              $tf->logoutFrontEndUser();            $tf->loginFrontEndUser($userId);
The   testing framework
              can fake almost everything
       $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());


       $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array());


   $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array());


                           $tf->createTemplate($pageId, array $recordData = array());


                                     $pageUid = $tf->createFakeFrontEnd($pageUid = 0);


                                                           $tf->discardFakeFrontEnd();


                $groupUid = $tf->createFrontEndUserGroup(array $recordData = array());


        $userUid = $tf->createFrontEndUser($groups = '', array $recordData = array());


               $tf->logoutFrontEndUser();             $tf->loginFrontEndUser($userId);


$userUid = $tf->createAndLoginFrontEndUser($groups = '', array $recordData = array());
The   testing framework
              can fake almost everything
       $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());


       $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array());


   $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array());


                           $tf->createTemplate($pageId, array $recordData = array());


                                     $pageUid = $tf->createFakeFrontEnd($pageUid = 0);


                                                           $tf->discardFakeFrontEnd();


                $groupUid = $tf->createFrontEndUserGroup(array $recordData = array());


        $userUid = $tf->createFrontEndUser($groups = '', array $recordData = array());


               $tf->logoutFrontEndUser();             $tf->loginFrontEndUser($userId);


$userUid = $tf->createAndLoginFrontEndUser($groups = '', array $recordData = array());


                                                      $isLoggedIn = $tf->isLoggedIn();
The   testing framework
              can fake almost everything
The   testing framework
              can fake almost everything
            $recordUid = $tf->createBackEndUser(array $recordData = array());
The   testing framework
              can fake almost everything
              $recordUid = $tf->createBackEndUser(array $recordData = array());

         $recordUid = $tf->createBackEndUserGroup(array $recordData = array());
The   testing framework
              can fake almost everything
The   testing framework
              can fake almost everything
          $path = $tf->createDummyFile($fileName = 'test.txt', $content = '');
The   testing framework
                can fake almost everything
                    $path = $tf->createDummyFile($fileName = 'test.txt', $content = '');


$path = $tf->createDummyZipArchive($fileName = 'test.zip', array $filesToAdd = array());
The   testing framework
                can fake almost everything
                    $path = $tf->createDummyFile($fileName = 'test.txt', $content = '');


$path = $tf->createDummyZipArchive($fileName = 'test.zip', array $filesToAdd = array());

                                                        $tf->deleteDummyFile($fileName);
The   testing framework
                can fake almost everything
                    $path = $tf->createDummyFile($fileName = 'test.txt', $content = '');


$path = $tf->createDummyZipArchive($fileName = 'test.zip', array $filesToAdd = array());

                                                        $tf->deleteDummyFile($fileName);


                                            $path = $tf->createDummyFolder($folderName);
The   testing framework
                can fake almost everything
                    $path = $tf->createDummyFile($fileName = 'test.txt', $content = '');


$path = $tf->createDummyZipArchive($fileName = 'test.zip', array $filesToAdd = array());

                                                        $tf->deleteDummyFile($fileName);


                                            $path = $tf->createDummyFolder($folderName);

                                                    $tf->deleteDummyFolder($folderName);

Weitere Àhnliche Inhalte

Was ist angesagt?

Py.test
Py.testPy.test
Py.testsoasme
 
Testes pythonicos com pytest
Testes pythonicos com pytestTestes pythonicos com pytest
Testes pythonicos com pytestviniciusban
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistAnton Arhipov
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test frameworkAbner Chih Yi Huang
 
Grammatical Optimization
Grammatical OptimizationGrammatical Optimization
Grammatical Optimizationadil raja
 
What is wrong on Test::More? / Test::MoreăŒæŠ±ăˆă‚‹ć•éĄŒç‚čăšăăźè§Łæ±ș策
What is wrong on Test::More? / Test::MoreăŒæŠ±ăˆă‚‹ć•éĄŒç‚čăšăăźè§Łæ±ș策What is wrong on Test::More? / Test::MoreăŒæŠ±ăˆă‚‹ć•éĄŒç‚čăšăăźè§Łæ±ș策
What is wrong on Test::More? / Test::MoreăŒæŠ±ăˆă‚‹ć•éĄŒç‚čăšăăźè§Łæ±ș策kwatch
 
Google Guava for cleaner code
Google Guava for cleaner codeGoogle Guava for cleaner code
Google Guava for cleaner codeMite Mitreski
 
Unittesting JavaScript with Evidence
Unittesting JavaScript with EvidenceUnittesting JavaScript with Evidence
Unittesting JavaScript with EvidenceTobie Langel
 
Google Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG NantesGoogle Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG Nantesmikaelbarbero
 
Pytest: escreva menos, teste mais
Pytest: escreva menos, teste maisPytest: escreva menos, teste mais
Pytest: escreva menos, teste maisErick Wilder
 
Riga Dev Day 2016 - Having fun with Javassist
Riga Dev Day 2016 - Having fun with JavassistRiga Dev Day 2016 - Having fun with Javassist
Riga Dev Day 2016 - Having fun with JavassistAnton Arhipov
 
Test in action week 2
Test in action   week 2Test in action   week 2
Test in action week 2Yi-Huan Chan
 
Beautiful code
Beautiful codeBeautiful code
Beautiful codePeter Hilton
 
ĐąĐ”ŃŃ‚ĐžŃ€ĐŸĐČĐ°ĐœĐžĐ” Đž Django
ĐąĐ”ŃŃ‚ĐžŃ€ĐŸĐČĐ°ĐœĐžĐ” Đž DjangoĐąĐ”ŃŃ‚ĐžŃ€ĐŸĐČĐ°ĐœĐžĐ” Đž Django
ĐąĐ”ŃŃ‚ĐžŃ€ĐŸĐČĐ°ĐœĐžĐ” Đž DjangoMoscowDjango
 
Beginning PHPUnit
Beginning PHPUnitBeginning PHPUnit
Beginning PHPUnitJace Ju
 
JavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistJavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistAnton Arhipov
 
Unit Testing using PHPUnit
Unit Testing using  PHPUnitUnit Testing using  PHPUnit
Unit Testing using PHPUnitvaruntaliyan
 
Unit Testing Presentation
Unit Testing PresentationUnit Testing Presentation
Unit Testing Presentationnicobn
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleAnton Arhipov
 

Was ist angesagt? (20)

UPC Testing talk 2
UPC Testing talk 2UPC Testing talk 2
UPC Testing talk 2
 
Py.test
Py.testPy.test
Py.test
 
Testes pythonicos com pytest
Testes pythonicos com pytestTestes pythonicos com pytest
Testes pythonicos com pytest
 
JEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with JavassistJEEConf 2017 - Having fun with Javassist
JEEConf 2017 - Having fun with Javassist
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test framework
 
Grammatical Optimization
Grammatical OptimizationGrammatical Optimization
Grammatical Optimization
 
What is wrong on Test::More? / Test::MoreăŒæŠ±ăˆă‚‹ć•éĄŒç‚čăšăăźè§Łæ±ș策
What is wrong on Test::More? / Test::MoreăŒæŠ±ăˆă‚‹ć•éĄŒç‚čăšăăźè§Łæ±ș策What is wrong on Test::More? / Test::MoreăŒæŠ±ăˆă‚‹ć•éĄŒç‚čăšăăźè§Łæ±ș策
What is wrong on Test::More? / Test::MoreăŒæŠ±ăˆă‚‹ć•éĄŒç‚čăšăăźè§Łæ±ș策
 
Google Guava for cleaner code
Google Guava for cleaner codeGoogle Guava for cleaner code
Google Guava for cleaner code
 
Unittesting JavaScript with Evidence
Unittesting JavaScript with EvidenceUnittesting JavaScript with Evidence
Unittesting JavaScript with Evidence
 
Google Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG NantesGoogle Guava & EMF @ GTUG Nantes
Google Guava & EMF @ GTUG Nantes
 
Pytest: escreva menos, teste mais
Pytest: escreva menos, teste maisPytest: escreva menos, teste mais
Pytest: escreva menos, teste mais
 
Riga Dev Day 2016 - Having fun with Javassist
Riga Dev Day 2016 - Having fun with JavassistRiga Dev Day 2016 - Having fun with Javassist
Riga Dev Day 2016 - Having fun with Javassist
 
Test in action week 2
Test in action   week 2Test in action   week 2
Test in action week 2
 
Beautiful code
Beautiful codeBeautiful code
Beautiful code
 
ĐąĐ”ŃŃ‚ĐžŃ€ĐŸĐČĐ°ĐœĐžĐ” Đž Django
ĐąĐ”ŃŃ‚ĐžŃ€ĐŸĐČĐ°ĐœĐžĐ” Đž DjangoĐąĐ”ŃŃ‚ĐžŃ€ĐŸĐČĐ°ĐœĐžĐ” Đž Django
ĐąĐ”ŃŃ‚ĐžŃ€ĐŸĐČĐ°ĐœĐžĐ” Đž Django
 
Beginning PHPUnit
Beginning PHPUnitBeginning PHPUnit
Beginning PHPUnit
 
JavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with JavassistJavaOne 2015 - Having fun with Javassist
JavaOne 2015 - Having fun with Javassist
 
Unit Testing using PHPUnit
Unit Testing using  PHPUnitUnit Testing using  PHPUnit
Unit Testing using PHPUnit
 
Unit Testing Presentation
Unit Testing PresentationUnit Testing Presentation
Unit Testing Presentation
 
GeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassleGeeCON 2017 - TestContainers. Integration testing without the hassle
GeeCON 2017 - TestContainers. Integration testing without the hassle
 

Ähnlich wie Test-Driven Development for TYPO3

Pragmatic unittestingwithj unit
Pragmatic unittestingwithj unitPragmatic unittestingwithj unit
Pragmatic unittestingwithj unitliminescence
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartGabriele Lana
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitFighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitJames Fuller
 
(Unit )-Testing for Joomla
(Unit )-Testing for Joomla(Unit )-Testing for Joomla
(Unit )-Testing for JoomlaDavid Jardin
 
Test in action week 4
Test in action   week 4Test in action   week 4
Test in action week 4Yi-Huan Chan
 
Commencer avec le TDD
Commencer avec le TDDCommencer avec le TDD
Commencer avec le TDDEric Hogue
 
Php unit the-mostunknownparts
Php unit the-mostunknownpartsPhp unit the-mostunknownparts
Php unit the-mostunknownpartsBastian Feder
 
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnitinternational PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnitsmueller_sandsmedia
 
PHPUnit best practices presentation
PHPUnit best practices presentationPHPUnit best practices presentation
PHPUnit best practices presentationThanh Robi
 
Php Unit With Zend Framework Zendcon09
Php Unit With Zend Framework   Zendcon09Php Unit With Zend Framework   Zendcon09
Php Unit With Zend Framework Zendcon09Michelangelo van Dam
 
Automated Unit Testing
Automated Unit TestingAutomated Unit Testing
Automated Unit TestingMike Lively
 
Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testingjeresig
 

Ähnlich wie Test-Driven Development for TYPO3 (20)

JUnit
JUnitJUnit
JUnit
 
Pragmatic unittestingwithj unit
Pragmatic unittestingwithj unitPragmatic unittestingwithj unit
Pragmatic unittestingwithj unit
 
Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing Part
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitFighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnit
 
(Unit )-Testing for Joomla
(Unit )-Testing for Joomla(Unit )-Testing for Joomla
(Unit )-Testing for Joomla
 
Python unittest
Python unittestPython unittest
Python unittest
 
3 j unit
3 j unit3 j unit
3 j unit
 
Test in action week 4
Test in action   week 4Test in action   week 4
Test in action week 4
 
Tdd & unit test
Tdd & unit testTdd & unit test
Tdd & unit test
 
Commencer avec le TDD
Commencer avec le TDDCommencer avec le TDD
Commencer avec le TDD
 
Php unit the-mostunknownparts
Php unit the-mostunknownpartsPhp unit the-mostunknownparts
Php unit the-mostunknownparts
 
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnitinternational PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
international PHP2011_Bastian Feder_The most unknown Parts of PHPUnit
 
JUnit 5
JUnit 5JUnit 5
JUnit 5
 
PHPUnit best practices presentation
PHPUnit best practices presentationPHPUnit best practices presentation
PHPUnit best practices presentation
 
Php Unit With Zend Framework Zendcon09
Php Unit With Zend Framework   Zendcon09Php Unit With Zend Framework   Zendcon09
Php Unit With Zend Framework Zendcon09
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
JUnit Pioneer
JUnit PioneerJUnit Pioneer
JUnit Pioneer
 
Automated Unit Testing
Automated Unit TestingAutomated Unit Testing
Automated Unit Testing
 
Java custom annotations example
Java custom annotations exampleJava custom annotations example
Java custom annotations example
 
Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testing
 

Mehr von Oliver Klee

Stand das im Handbuch?
Stand das im Handbuch?Stand das im Handbuch?
Stand das im Handbuch?Oliver Klee
 
Objektorientierte Programmierung mit extbase und fluid
Objektorientierte Programmierung mit extbase und fluidObjektorientierte Programmierung mit extbase und fluid
Objektorientierte Programmierung mit extbase und fluidOliver Klee
 
Stand das im Handbuch?
Stand das im Handbuch?Stand das im Handbuch?
Stand das im Handbuch?Oliver Klee
 
Test-Driven Development ... und mehr
Test-Driven Development ... und mehrTest-Driven Development ... und mehr
Test-Driven Development ... und mehrOliver Klee
 
Test-driven Development mit TYPO3
Test-driven Development mit TYPO3Test-driven Development mit TYPO3
Test-driven Development mit TYPO3Oliver Klee
 
Test-driven development with TYPO3 (T3CON10)
Test-driven development with TYPO3 (T3CON10)Test-driven development with TYPO3 (T3CON10)
Test-driven development with TYPO3 (T3CON10)Oliver Klee
 
Persönliches Zeitmanagement mit Getting Things Done (GTD)
Persönliches Zeitmanagement mit Getting Things Done (GTD)Persönliches Zeitmanagement mit Getting Things Done (GTD)
Persönliches Zeitmanagement mit Getting Things Done (GTD)Oliver Klee
 
Everything you need to know about the TYPO3 Security Team (T3DD10)
Everything you need to know about the TYPO3 Security Team (T3DD10)Everything you need to know about the TYPO3 Security Team (T3DD10)
Everything you need to know about the TYPO3 Security Team (T3DD10)Oliver Klee
 
TDD & Best Practices mit TYPO3
TDD & Best Practices mit TYPO3TDD & Best Practices mit TYPO3
TDD & Best Practices mit TYPO3Oliver Klee
 
Unit testing for the TYPO3 4.x core (T3DD10)
Unit testing for the TYPO3 4.x core (T3DD10)Unit testing for the TYPO3 4.x core (T3DD10)
Unit testing for the TYPO3 4.x core (T3DD10)Oliver Klee
 
GPG Workshop
GPG WorkshopGPG Workshop
GPG WorkshopOliver Klee
 
Unit testing for the TYPO3 4.x core
Unit testing for the TYPO3 4.x coreUnit testing for the TYPO3 4.x core
Unit testing for the TYPO3 4.x coreOliver Klee
 

Mehr von Oliver Klee (12)

Stand das im Handbuch?
Stand das im Handbuch?Stand das im Handbuch?
Stand das im Handbuch?
 
Objektorientierte Programmierung mit extbase und fluid
Objektorientierte Programmierung mit extbase und fluidObjektorientierte Programmierung mit extbase und fluid
Objektorientierte Programmierung mit extbase und fluid
 
Stand das im Handbuch?
Stand das im Handbuch?Stand das im Handbuch?
Stand das im Handbuch?
 
Test-Driven Development ... und mehr
Test-Driven Development ... und mehrTest-Driven Development ... und mehr
Test-Driven Development ... und mehr
 
Test-driven Development mit TYPO3
Test-driven Development mit TYPO3Test-driven Development mit TYPO3
Test-driven Development mit TYPO3
 
Test-driven development with TYPO3 (T3CON10)
Test-driven development with TYPO3 (T3CON10)Test-driven development with TYPO3 (T3CON10)
Test-driven development with TYPO3 (T3CON10)
 
Persönliches Zeitmanagement mit Getting Things Done (GTD)
Persönliches Zeitmanagement mit Getting Things Done (GTD)Persönliches Zeitmanagement mit Getting Things Done (GTD)
Persönliches Zeitmanagement mit Getting Things Done (GTD)
 
Everything you need to know about the TYPO3 Security Team (T3DD10)
Everything you need to know about the TYPO3 Security Team (T3DD10)Everything you need to know about the TYPO3 Security Team (T3DD10)
Everything you need to know about the TYPO3 Security Team (T3DD10)
 
TDD & Best Practices mit TYPO3
TDD & Best Practices mit TYPO3TDD & Best Practices mit TYPO3
TDD & Best Practices mit TYPO3
 
Unit testing for the TYPO3 4.x core (T3DD10)
Unit testing for the TYPO3 4.x core (T3DD10)Unit testing for the TYPO3 4.x core (T3DD10)
Unit testing for the TYPO3 4.x core (T3DD10)
 
GPG Workshop
GPG WorkshopGPG Workshop
GPG Workshop
 
Unit testing for the TYPO3 4.x core
Unit testing for the TYPO3 4.x coreUnit testing for the TYPO3 4.x core
Unit testing for the TYPO3 4.x core
 

KĂŒrzlich hochgeladen

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
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
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
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
 

KĂŒrzlich hochgeladen (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
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
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
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
 

Test-Driven Development for TYPO3

  • 1. Test-Driven Development for TYPO3 Oliver Klee, 2011-07-08 typo3-coding@oliverklee.de
  • 3. Manual testing is cumbersome
  • 5. Unit tests for the Realty Manager extension
  • 7. in less than 60 seconds
  • 8. Verify that your code does what you expect
  • 9. Make sure that your changes won‘t break anything
  • 10. Keep other coders from breaking your code
  • 11. Don‘t break anything even in complex projects
  • 12. Create asafety net for refactoring
  • 15. Know your tools
  • 16. The phpunit extension has it all
  • 17. The phpunit extension has it all phpunit (TYPO3 extension)
  • 18. The phpunit extension has it all phpunit (TYPO3 extension) PHPUnit (PEAR package)
  • 19. The phpunit extension has it all phpunit (TYPO3 extension) PHPUnit (PEAR package) Testrunner (back-end- module)
  • 20. The phpunit extension has it all phpunit (TYPO3 extension) PHPUnit (PEAR package) Testrunner Testrunner (back-end- module) (CLI module)
  • 21. The phpunit extension has it all phpunit (TYPO3 extension) PHPUnit (PEAR package) Testing framework for FE & DB Testrunner Testrunner (back-end- module) (CLI module)
  • 23. Two tests meet in a bar ...
  • 24. Two tests Test meet in a bar ...
  • 25. Two tests Test meet in a Assertion bar ...
  • 26. Two tests Test meet in a Assertion bar ... Test Test
  • 27. Two tests Test meet in a Assertion bar ... Test Test Test case
  • 28. Two tests Test meet in a Assertion bar ... Test Test Test case Test case
  • 29. Two tests Test meet in a Assertion bar ... Test Test Test case Test case Test suite
  • 30. The life cycle unit test of a
  • 31. The life cycle unit test of a
  • 32. The life cycle unit test of a new FooTest();
  • 33. The life cycle unit test of a new FooTest();
  • 34. The life cycle unit test of a new FooTest(); setUp();
  • 35. The life cycle unit test of a new FooTest(); setUp(); /** @test */ lifeIsGood();
  • 36. The life cycle unit test of a new FooTest(); setUp(); /** @test */ lifeIsGood();
  • 37. The life cycle unit test of a new FooTest(); setUp(); /** @test */ lifeIsGood(); tearDown();
  • 38. The life cycle unit test of a new FooTest(); setUp(); /** @test */ lifeIsGood(); tearDown();
  • 39. The life cycle unit test of a new FooTest(); setUp(); /** @test */ lifeIsGood(); tearDown();
  • 40. Use meaningful unit test names
  • 41. Use meaningful unit test names Name the behavior. classCanBeInstantiated
  • 42. Use meaningful unit test names Name the behavior. classCanBeInstantiated Mention the method. setTitleSetsTitle
  • 43. Use meaningful unit test names Name the behavior. classCanBeInstantiated Mention the method. setTitleSetsTitle Name the setSizeWithZeroThrowsException preconditions. hasTitleForEmptyTitleReturnsFalse
  • 44. Use meaningful unit test names Name the behavior. classCanBeInstantiated Mention the method. setTitleSetsTitle Name the setSizeWithZeroThrowsException preconditions. hasTitleForEmptyTitleReturnsFalse Dont‘t use "works" or "correctly".
  • 45. Use meaningful unit test names Name the behavior. classCanBeInstantiated Mention the method. setTitleSetsTitle Name the setSizeWithZeroThrowsException preconditions. hasTitleForEmptyTitleReturnsFalse Dont‘t use "works" or measureFrubbleWorksCorrectly "correctly".
  • 46. Use meaningful unit test names Name the behavior. classCanBeInstantiated Mention the method. setTitleSetsTitle Name the setSizeWithZeroThrowsException preconditions. hasTitleForEmptyTitleReturnsFalse Dont‘t use "works" or measureFrubbleWorksCorrectly "correctly".
  • 47. Code test-first
  • 48. Code test-first
  • 49. Code test-first write test
  • 50. Code test-first write test
  • 51. Code test-first write write test code
  • 52. Code test-first write write test code
  • 53. Code test-first write write test code
  • 54. Code test-first write write test code refactor
  • 55. Code test-first write write test code refactor
  • 56.
  • 57. There are small and huge tests
  • 58. Unit tests are small and fast
  • 59. Integration tests test the complete thing
  • 60. Automated click tests test the interface
  • 61. Automated click tests test the interface Selenium
  • 62. Blackbox tests test the public interface
  • 63. Whitebox tests test the inner workings
  • 64. The testing framework is created quickly /** * @var Tx_Phpunit_Framework */ protected $testingFramework = NULL; public function setUp() { $this->testingFramework = new Tx_Phpunit_Framework('tx_news2'); } public function tearDown() { $this->testingFramework->cleanUp(); unset($this->testingFramework); }
  • 65. The testing framework is created quickly /** * @var Tx_Phpunit_Framework */ protected $testingFramework = NULL; public function setUp() { $this->testingFramework = new Tx_Phpunit_Framework('tx_news2'); } discard the FE, public function tearDown() { delete DB records, $this->testingFramework->cleanUp(); unset($this->testingFramework); delete ïŹles }
  • 66. The testing framework is created quickly /** * @var Tx_Phpunit_Framework */ protected $testingFramework = NULL; public function setUp() { $this->testingFramework = new Tx_Phpunit_Framework('tx_news2'); } discard the FE, public function tearDown() { delete DB records, $this->testingFramework->cleanUp(); unset($this->testingFramework); delete ïŹles } CREATE TABLE tx_news2_domain_model_news ( 
 is_dummy_record tinyint(1) unsigned DEFAULT '0' NOT NULL, 

  • 67. The testing framework can fake almost everything
  • 68. The testing framework can fake almost everything $recordUid = $tf->createRecord($tableName, array $recordData = array());
  • 69. The testing framework can fake almost everything $recordUid = $tf->createRecord($tableName, array $recordData = array()); $tf->changeRecord($tableName, $uid, array $recordData);
  • 70. The testing framework can fake almost everything $recordUid = $tf->createRecord($tableName, array $recordData = array()); $tf->changeRecord($tableName, $uid, array $recordData); $tf->deleteRecord($tableName, $uid);
  • 71. The testing framework can fake almost everything $recordUid = $tf->createRecord($tableName, array $recordData = array()); $tf->changeRecord($tableName, $uid, array $recordData); $tf->deleteRecord($tableName, $uid); $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0);
  • 72. The testing framework can fake almost everything $recordUid = $tf->createRecord($tableName, array $recordData = array()); $tf->changeRecord($tableName, $uid, array $recordData); $tf->deleteRecord($tableName, $uid); $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0); $tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName);
  • 73. The testing framework can fake almost everything $recordUid = $tf->createRecord($tableName, array $recordData = array()); $tf->changeRecord($tableName, $uid, array $recordData); $tf->deleteRecord($tableName, $uid); $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0); $tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName); $tf->removeRelation($tableName, $uidLocal, $uidForeign);
  • 74. The testing framework can fake almost everything $recordUid = $tf->createRecord($tableName, array $recordData = array()); $tf->changeRecord($tableName, $uid, array $recordData); $tf->deleteRecord($tableName, $uid); $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0); $tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName); $tf->removeRelation($tableName, $uidLocal, $uidForeign); $numberOfRecords = $tf->countRecords($tableName, $whereClause = '');
  • 75. The testing framework can fake almost everything $recordUid = $tf->createRecord($tableName, array $recordData = array()); $tf->changeRecord($tableName, $uid, array $recordData); $tf->deleteRecord($tableName, $uid); $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0); $tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName); $tf->removeRelation($tableName, $uidLocal, $uidForeign); $numberOfRecords = $tf->countRecords($tableName, $whereClause = ''); $success = $tf->existsRecord($tableName, $whereClause = '');
  • 76. The testing framework can fake almost everything $recordUid = $tf->createRecord($tableName, array $recordData = array()); $tf->changeRecord($tableName, $uid, array $recordData); $tf->deleteRecord($tableName, $uid); $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0); $tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName); $tf->removeRelation($tableName, $uidLocal, $uidForeign); $numberOfRecords = $tf->countRecords($tableName, $whereClause = ''); $success = $tf->existsRecord($tableName, $whereClause = ''); $success = $tf->existsExactlyOneRecord($tableName, $whereClause = '');
  • 77. The testing framework can fake almost everything $recordUid = $tf->createRecord($tableName, array $recordData = array()); $tf->changeRecord($tableName, $uid, array $recordData); $tf->deleteRecord($tableName, $uid); $tf->createRelation($tableName, $uidLocal, $uidForeign, $sorting = 0); $tf->createRelationAndUpdateCounter($tableName, $uidLocal, $uidForeign, $columnName); $tf->removeRelation($tableName, $uidLocal, $uidForeign); $numberOfRecords = $tf->countRecords($tableName, $whereClause = ''); $success = $tf->existsRecord($tableName, $whereClause = ''); $success = $tf->existsExactlyOneRecord($tableName, $whereClause = ''); $success = $tf->existsRecordWithUid($tableName, $uid);
  • 78. The testing framework can fake almost everything
  • 79. The testing framework can fake almost everything $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array());
  • 80. The testing framework can fake almost everything $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array()); $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array());
  • 81. The testing framework can fake almost everything $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array()); $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array()); $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array());
  • 82. The testing framework can fake almost everything $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array()); $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array()); $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array()); $tf->createTemplate($pageId, array $recordData = array());
  • 83. The testing framework can fake almost everything $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array()); $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array()); $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array()); $tf->createTemplate($pageId, array $recordData = array()); $pageUid = $tf->createFakeFrontEnd($pageUid = 0);
  • 84. The testing framework can fake almost everything $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array()); $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array()); $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array()); $tf->createTemplate($pageId, array $recordData = array()); $pageUid = $tf->createFakeFrontEnd($pageUid = 0); $tf->discardFakeFrontEnd();
  • 85. The testing framework can fake almost everything $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array()); $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array()); $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array()); $tf->createTemplate($pageId, array $recordData = array()); $pageUid = $tf->createFakeFrontEnd($pageUid = 0); $tf->discardFakeFrontEnd(); $groupUid = $tf->createFrontEndUserGroup(array $recordData = array());
  • 86. The testing framework can fake almost everything $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array()); $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array()); $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array()); $tf->createTemplate($pageId, array $recordData = array()); $pageUid = $tf->createFakeFrontEnd($pageUid = 0); $tf->discardFakeFrontEnd(); $groupUid = $tf->createFrontEndUserGroup(array $recordData = array()); $userUid = $tf->createFrontEndUser($groups = '', array $recordData = array());
  • 87. The testing framework can fake almost everything $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array()); $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array()); $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array()); $tf->createTemplate($pageId, array $recordData = array()); $pageUid = $tf->createFakeFrontEnd($pageUid = 0); $tf->discardFakeFrontEnd(); $groupUid = $tf->createFrontEndUserGroup(array $recordData = array()); $userUid = $tf->createFrontEndUser($groups = '', array $recordData = array()); $tf->loginFrontEndUser($userId);
  • 88. The testing framework can fake almost everything $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array()); $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array()); $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array()); $tf->createTemplate($pageId, array $recordData = array()); $pageUid = $tf->createFakeFrontEnd($pageUid = 0); $tf->discardFakeFrontEnd(); $groupUid = $tf->createFrontEndUserGroup(array $recordData = array()); $userUid = $tf->createFrontEndUser($groups = '', array $recordData = array()); $tf->logoutFrontEndUser(); $tf->loginFrontEndUser($userId);
  • 89. The testing framework can fake almost everything $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array()); $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array()); $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array()); $tf->createTemplate($pageId, array $recordData = array()); $pageUid = $tf->createFakeFrontEnd($pageUid = 0); $tf->discardFakeFrontEnd(); $groupUid = $tf->createFrontEndUserGroup(array $recordData = array()); $userUid = $tf->createFrontEndUser($groups = '', array $recordData = array()); $tf->logoutFrontEndUser(); $tf->loginFrontEndUser($userId); $userUid = $tf->createAndLoginFrontEndUser($groups = '', array $recordData = array());
  • 90. The testing framework can fake almost everything $pageUid = $tf->createFrontEndPage($parentId = 0, array $recordData = array()); $pageUid = $tf->createSystemFolder($parentId = 0, array $recordData = array()); $elementUid = $tf->createContentElement($pageId = 0, array $recordData = array()); $tf->createTemplate($pageId, array $recordData = array()); $pageUid = $tf->createFakeFrontEnd($pageUid = 0); $tf->discardFakeFrontEnd(); $groupUid = $tf->createFrontEndUserGroup(array $recordData = array()); $userUid = $tf->createFrontEndUser($groups = '', array $recordData = array()); $tf->logoutFrontEndUser(); $tf->loginFrontEndUser($userId); $userUid = $tf->createAndLoginFrontEndUser($groups = '', array $recordData = array()); $isLoggedIn = $tf->isLoggedIn();
  • 91. The testing framework can fake almost everything
  • 92. The testing framework can fake almost everything $recordUid = $tf->createBackEndUser(array $recordData = array());
  • 93. The testing framework can fake almost everything $recordUid = $tf->createBackEndUser(array $recordData = array()); $recordUid = $tf->createBackEndUserGroup(array $recordData = array());
  • 94. The testing framework can fake almost everything
  • 95. The testing framework can fake almost everything $path = $tf->createDummyFile($fileName = 'test.txt', $content = '');
  • 96. The testing framework can fake almost everything $path = $tf->createDummyFile($fileName = 'test.txt', $content = ''); $path = $tf->createDummyZipArchive($fileName = 'test.zip', array $filesToAdd = array());
  • 97. The testing framework can fake almost everything $path = $tf->createDummyFile($fileName = 'test.txt', $content = ''); $path = $tf->createDummyZipArchive($fileName = 'test.zip', array $filesToAdd = array()); $tf->deleteDummyFile($fileName);
  • 98. The testing framework can fake almost everything $path = $tf->createDummyFile($fileName = 'test.txt', $content = ''); $path = $tf->createDummyZipArchive($fileName = 'test.zip', array $filesToAdd = array()); $tf->deleteDummyFile($fileName); $path = $tf->createDummyFolder($folderName);
  • 99. The testing framework can fake almost everything $path = $tf->createDummyFile($fileName = 'test.txt', $content = ''); $path = $tf->createDummyZipArchive($fileName = 'test.zip', array $filesToAdd = array()); $tf->deleteDummyFile($fileName); $path = $tf->createDummyFolder($folderName); $tf->deleteDummyFolder($folderName);

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n