Unit testing for the
TYPO3 4.x core
Brush-up on unit testing   What has happened so far?




How you can use it now     How TYPO3 will benefit
Brush-up on unit testing   What has happened so far?




How you can use it now     How TYPO3 will benefit
Have you already
    unit-tested
                   today?
Have you already
    unit-tested
                   today?
Manual testing is cumbersome
Automated
testing is
fast
Unit tests for the
Seminar Manager
   extension
More than
2400 tests
Less than
90 seconds
(or 3 minutes
      on my laptop)
Verify your code with
unit tests
Catch regressions
Create a safety net
    for refactoring
Brush-up on unit testing   What has happened so far?




How you can use it now     How TYPO3 will benefit
The PHPUnit extension
now can run tests
for the Core
The PHPUnit extension
now can run tests
for the Core


        (I‘ll show you)
Survey in the
dev newsgroup
Survey in the
dev newsgroup
  tslib_TCEmain


   tslib_content


       t3lib_div


t3lib_TStemplate

                   0...
t3lib_TCEmain needs it badly
„t3lib_TCEmain, t3lib_refindex,
t3lib_BEfunc

The first one should keep you
busy for a month ...
Proof-of-concept
unit tests for TCEmain
More tests
have been added
More tests
             have been added
  t3lib_cache_backend_*
                     t3lib_div
          t3lib_cache_Manag...
Brush-up on unit testing   What has happened so far?




How you can use it now     How TYPO3 will benefit
Write unit tests to
learn how some parts
     of the core work
Write unit tests to
learn how some parts
     of the core work
Write unit tests to
learn how some parts
     of the core work
        Let‘s do it!
Write unit tests before
you fix a bug
Make sure your changes
   don‘t break anything
Before
refactoring,
 write tests
     for the
    affected
        code
Brush-up on unit testing   What has happened so far?




How you can use it now     How TYPO3 will benefit
Diploma thesis
        at the University of Bonn


 „Unit testing as a way to detect
 design flaws and hidden bugs in
     ...
TCEmain will get
    more tests
TCEmain will get
              more tests
Time planned for
writing unit tests:
TCEmain will get
              more tests
Time planned for
writing unit tests:

   2 months
More knowledge on
    bad smells in the code
Too many
dependencies
Too many
    direct API calls
Too many
    direct API calls
Monster
    methods
Read more
on this
More knowledge on
Bugs that slip past
manual testing
 (but can be found with unit tests)
More
knowledge
   on



         bugs in lower levels
  (because you are testing in the GUI)
More knowledge on
   remote regressions
More knowledge on




   masked regressions
More knowledge on
       extreme cases
More knowledge on
         extreme cases



testing with
1000 000 records
Writing unit tests
is a lot of work.




            (Tell me something new.)
Rules for
  PHPCodeSniffer
   for finding these
    bugs and smells
            quicker
Brush-up on unit testing   What has happened so far?




How you can use it now     How TYPO3 will benefit
Questions?
Thank you.
Upcoming SlideShare
Loading in...5
×

Unit testing for the TYPO3 4.x core

2,391

Published on

Published in: Technology
2 Comments
2 Likes
Statistics
Notes
No Downloads
Views
Total Views
2,391
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
2
Likes
2
Embeds 0
No embeds

No notes for slide
































































































  • Unit testing for the TYPO3 4.x core

    1. 1. Unit testing for the TYPO3 4.x core
    2. 2. Brush-up on unit testing What has happened so far? How you can use it now How TYPO3 will benefit
    3. 3. Brush-up on unit testing What has happened so far? How you can use it now How TYPO3 will benefit
    4. 4. Have you already unit-tested today?
    5. 5. Have you already unit-tested today?
    6. 6. Manual testing is cumbersome
    7. 7. Automated testing is fast
    8. 8. Unit tests for the Seminar Manager extension
    9. 9. More than 2400 tests
    10. 10. Less than 90 seconds
    11. 11. (or 3 minutes on my laptop)
    12. 12. Verify your code with unit tests
    13. 13. Catch regressions
    14. 14. Create a safety net for refactoring
    15. 15. Brush-up on unit testing What has happened so far? How you can use it now How TYPO3 will benefit
    16. 16. The PHPUnit extension now can run tests for the Core
    17. 17. The PHPUnit extension now can run tests for the Core (I‘ll show you)
    18. 18. Survey in the dev newsgroup
    19. 19. Survey in the dev newsgroup tslib_TCEmain tslib_content t3lib_div t3lib_TStemplate 0 1 2 3 4 5 6
    20. 20. t3lib_TCEmain needs it badly „t3lib_TCEmain, t3lib_refindex, t3lib_BEfunc The first one should keep you busy for a month :D“ (post by Dmitry)
    21. 21. Proof-of-concept unit tests for TCEmain
    22. 22. More tests have been added
    23. 23. More tests have been added t3lib_cache_backend_* t3lib_div t3lib_cache_Manager t3lib_cache_frontend_* t3lib_extmgm
    24. 24. Brush-up on unit testing What has happened so far? How you can use it now How TYPO3 will benefit
    25. 25. Write unit tests to learn how some parts of the core work
    26. 26. Write unit tests to learn how some parts of the core work
    27. 27. Write unit tests to learn how some parts of the core work Let‘s do it!
    28. 28. Write unit tests before you fix a bug
    29. 29. Make sure your changes don‘t break anything
    30. 30. Before refactoring, write tests for the affected code
    31. 31. Brush-up on unit testing What has happened so far? How you can use it now How TYPO3 will benefit
    32. 32. Diploma thesis at the University of Bonn „Unit testing as a way to detect design flaws and hidden bugs in existing TYPO3 code“ Planned total time: 6 months
    33. 33. TCEmain will get more tests
    34. 34. TCEmain will get more tests Time planned for writing unit tests:
    35. 35. TCEmain will get more tests Time planned for writing unit tests: 2 months
    36. 36. More knowledge on bad smells in the code
    37. 37. Too many dependencies
    38. 38. Too many direct API calls
    39. 39. Too many direct API calls
    40. 40. Monster methods
    41. 41. Read more on this
    42. 42. More knowledge on Bugs that slip past manual testing (but can be found with unit tests)
    43. 43. More knowledge on bugs in lower levels (because you are testing in the GUI)
    44. 44. More knowledge on remote regressions
    45. 45. More knowledge on masked regressions
    46. 46. More knowledge on extreme cases
    47. 47. More knowledge on extreme cases testing with 1000 000 records
    48. 48. Writing unit tests is a lot of work. (Tell me something new.)
    49. 49. Rules for PHPCodeSniffer for finding these bugs and smells quicker
    50. 50. Brush-up on unit testing What has happened so far? How you can use it now How TYPO3 will benefit
    51. 51. Questions?
    52. 52. Thank you.

    ×