Test Fest 2009
Upcoming SlideShare
Loading in...5
×
 

Test Fest 2009

on

  • 2,287 views

Presentation PHP Testfest 2009 Utrecht.

Presentation PHP Testfest 2009 Utrecht.

Statistics

Views

Total Views
2,287
Views on SlideShare
2,286
Embed Views
1

Actions

Likes
1
Downloads
6
Comments
0

1 Embed 1

https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Test Fest 2009 Test Fest 2009 Presentation Transcript

    • TestFest 2009 PHP Netherland, Utrecht Pierre Joye
    •  Thanks you for joining us!  First tests fest? First test (I won’t tell your boss)? Welcome to the TestFest 2009!
    •  PHP needs YOU  You need PHP too a broken PHP is useless A new Phpet is waiting for you! What should I bother?
    •  Improve code coverage  Fantastic opportunity to be part of PHP  Network to learn and work together What is this about?
    •  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
    •  (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)
    •  A bug  bug12345.phpt (bug.php.net/12345)  Features  <functionname>_basic.phpt  Errors  <functionname>_error.phpt  General  extname<test nr>.phpt Naming convention
    • --TEST— Not testing PHP --FILE— Goede morgen --EXPECT— Goede morgen Simplest test ever
    • --TEST— Let try to test echo! --FILE— <?php echo “Hoe doet u?”; ?> --EXPECT— Ik heb nodig koffie 2nd most simplest test ever (failing)
    • --TEST— rand --FILE— <?php echo “rand: ”. rand(); ?> --EXPECT— rand: %d Expect using printf syntax
    • --TEST— rand --FILE— <?php echo “rand: ”. rand(); ?> --EXPECTREGEX— M_E: 2.718281[0-9]* Expect using regex syntax (avoid it)
    • http://qa.php.net/expectf_details.php Where to find the EXPECTF placeholders list
    • --TEST— Timezone --INI— date.timezone=Europe/Berlin --FILE— <?php echo date_timezone_get(); ?> --EXPECT— Europe/Berlin Custom ini settings
    • --TEST— Timezone --SKIPIF— <?php if (! extension_loaded („myext‟) die(„myext not available‟); ?> --FILE— … --EXPECT— .. Conditional test
    • --TEST— Timezone --CREDITS— John TheWriter #testfest Utrecht 2009 --FILE— … --EXPECT— .. Render unto Caesar the things which are Caesar’s
    • http://qa.php.net/phpt_details.php Complete doc about phpt (with samples!)
    • Keep it smalll and beautiful Test one feature per phpt Avoid large output What is a good test?
    • If a large output is necessary Numerate or name each line Easier to analyze Easier to debug What is a good test?
    • PHP GCOV - Test and Code Coverage Analysis  http://gcov.php.net/ PHP WIKI - How to look at the test coverage for an extension  http://wiki.php.net/qa/testcoverage PHP QA - Writing Tests  http://qa.php.net/write-test.php Lessons Learned from PHPT  Writinghttp://wiki.php.net/qa/phptlessonslearned PHP CVS - README.TESTING  http://cvs.php.net/viewvc.cgi/php-src/README.TESTING Resources