Enrise testfest

1,077 views
1,017 views

Published on

Brief explanation on writing php unittests.

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,077
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
2
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Enrise testfest

    1. 1. Enrise mini testfestfebruary - 2011
    2. 2. What is a Testfest? 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.∂ WHAT IS IN IT FOR ME?
    3. 3. What is OUR Testfest? Mini test fest (evening instead of a full day) Maybe more often? Maybe full days? You decide,..
    4. 4. How to write a test (1) Simple text file with a bit of PHP code Test each component separately One test per .PHPT file
    5. 5. How to write a test (2) Bug: bug1234.phpt Feature: <function>_basic.phpt Error: <function>_error.phpt Global: <extension><nr>.phpt∂ NAMING CONVENTIONS
    6. 6. How to write a test (3) --TEST-- --CREDITS-- --SKIPIF-- --FILE-- --EXPECT-- / --EXPECTF-- --CLEAN--∂ PHPT SECTIONS
    7. 7. How to write a test (4) --TEST-- Trivial "Hello World" test --FILE-- <?php echo "Hello World"?> --EXPECT-- Hello World∂ EXAMPLE TEST (test/basic/001.phpt)
    8. 8. How to write a test (5) --TEST-- Check if echo works --CREDITS-- Joshua Thijssen <jthijssen@enrise.com> # Enrise TestFest 2011-02-11 --FILE-- <?php echo "Hello World"?> --EXPECT-- Hello World∂ EXAMPLE TEST
    9. 9. How to run your tests (1)∂ HTTP://TESTFEST.ENRISE.COM
    10. 10. How to run your tests (2)
    11. 11. What to test? http://gcov.php.net/PHP_5_3/lcov_html/ DOM (67.8%) STANDARD (78.1%) IMAP (64.4%) OPENSSL (63.1%) FTP (60.0%) SQLITE (74.7%) SNMP (7.8%) ZIP (65.4%)∂ HIGHER CODE COVERAGE DOES NOT ALWAYS MEAN BETTER TESTS!
    12. 12. More information Check out the URL’s: http://qa.php.net/write-test.php http://qa.php.net/phpt_details.php http://gcov.php.net/∂ MORE INFO ABOUT PHP UNIT-TESTING
    13. 13. More information When in doubt, ask one us to help you!∂ WE ARE HERE TO HELP!
    14. 14. ∂ LET’S SQUASH SOME BUGS

    ×