Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Enrise mini testfest - 2011

Enrise mini testfest - 2011

Joshua Thijssen

February 10, 2011
Tweet

More Decks by Joshua Thijssen

Other Decks in Programming

Transcript

  1. What is a Testfest? ∂ WHAT IS IN IT FOR

    ME? Fun gathering for PHP programmers and the like. Concentrating on writing unit tests. Making PHP better. Get your name into PHP credits. Drink free beer. woensdag 25 april 12
  2. What is OUR Testfest? Mini test fest (evening instead of

    a full day) Maybe more often? Maybe full days? You decide,.. woensdag 25 april 12
  3. How to write a test (1) Simple text file with

    a bit of PHP code Test each component separately One test per .PHPT file woensdag 25 april 12
  4. How to write a test (2) ∂ NAMING CONVENTIONS Bug:

    bug1234.phpt Feature: <function>_basic.phpt Error: <function>_error.phpt Global: <extension><nr>.phpt woensdag 25 april 12
  5. How to write a test (3) ∂ PHPT SECTIONS --TEST--

    --CREDITS-- --SKIPIF-- --FILE-- --EXPECT-- / --EXPECTF-- --CLEAN-- woensdag 25 april 12
  6. How to write a test (4) ∂ EXAMPLE TEST (test/basic/001.phpt)

    --TEST-- Trivial "Hello World" test --FILE-- <?php echo "Hello World"?> --EXPECT-- Hello World woensdag 25 april 12
  7. How to write a test (5) ∂ EXAMPLE TEST --TEST--

    Check if echo works --CREDITS-- Joshua Thijssen <[email protected]> # Enrise TestFest 2011-02-11 --FILE-- <?php echo "Hello World"?> --EXPECT-- Hello World woensdag 25 april 12
  8. What to test? ∂ HIGHER CODE COVERAGE DOES NOT ALWAYS

    MEAN BETTER TESTS! DOM (67.8%) IMAP (64.4%) FTP (60.0%) SNMP (7.8%) http://gcov.php.net/PHP_5_3/lcov_html/ STANDARD (78.1%) OPENSSL (63.1%) SQLITE (74.7%) ZIP (65.4%) woensdag 25 april 12
  9. More information ∂ WE ARE HERE TO HELP! When in

    doubt, ask one us to help you! woensdag 25 april 12