Your SlideShare is downloading. ×
  • Like
Test Fest 2009
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Presentation PHP Testfest 2009 Utrecht.

Presentation PHP Testfest 2009 Utrecht.

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. TestFest 2009 PHP Netherland, Utrecht Pierre Joye
  • 2.  Thanks you for joining us!  First tests fest? First test (I won’t tell your boss)? Welcome to the TestFest 2009!
  • 3.  PHP needs YOU  You need PHP too a broken PHP is useless A new Phpet is waiting for you! What should I bother?
  • 4.  Improve code coverage  Fantastic opportunity to be part of PHP  Network to learn and work together What is this about?
  • 5.  Single test in a single .phpt file  Small set of similar tests in a .phpt file  Each test are run by calling a new php instance  Test isolation  Custom configuration  Support of segfaults and other fatal errors PHPT
  • 6.  (n)make test  make test TESTS=/home/joe/php/ext/reflection/tests  make test TESTS=/home/joe/php/ext/a/tests/b.phpt Testing PHP, everything (or less)
  • 7.  A bug  bug12345.phpt (  Features  <functionname>_basic.phpt  Errors  <functionname>_error.phpt  General  extname<test nr>.phpt Naming convention
  • 8. --TEST— Not testing PHP --FILE— Goede morgen --EXPECT— Goede morgen Simplest test ever
  • 9. --TEST— Let try to test echo! --FILE— <?php echo “Hoe doet u?”; ?> --EXPECT— Ik heb nodig koffie 2nd most simplest test ever (failing)
  • 10. --TEST— rand --FILE— <?php echo “rand: ”. rand(); ?> --EXPECT— rand: %d Expect using printf syntax
  • 11. --TEST— rand --FILE— <?php echo “rand: ”. rand(); ?> --EXPECTREGEX— M_E: 2.718281[0-9]* Expect using regex syntax (avoid it)
  • 12. Where to find the EXPECTF placeholders list
  • 13. --TEST— Timezone --INI— date.timezone=Europe/Berlin --FILE— <?php echo date_timezone_get(); ?> --EXPECT— Europe/Berlin Custom ini settings
  • 14. --TEST— Timezone --SKIPIF— <?php if (! extension_loaded („myext‟) die(„myext not available‟); ?> --FILE— … --EXPECT— .. Conditional test
  • 15. --TEST— Timezone --CREDITS— John TheWriter #testfest Utrecht 2009 --FILE— … --EXPECT— .. Render unto Caesar the things which are Caesar’s
  • 16. Complete doc about phpt (with samples!)
  • 17. Keep it smalll and beautiful Test one feature per phpt Avoid large output What is a good test?
  • 18. If a large output is necessary Numerate or name each line Easier to analyze Easier to debug What is a good test?
  • 19. PHP GCOV - Test and Code Coverage Analysis  PHP WIKI - How to look at the test coverage for an extension  PHP QA - Writing Tests  Lessons Learned from PHPT  Writing PHP CVS - README.TESTING  Resources