Your SlideShare is downloading. ×
  • Like
Enrise testfest
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

Enrise testfest

  • 733 views
Published

Brief explanation on writing php unittests.

Brief explanation on writing php unittests.

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

Views

Total Views
733
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
2
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Transcript

  • 1. Enrise mini testfestfebruary - 2011
  • 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. What is OUR Testfest? Mini test fest (evening instead of a full day) Maybe more often? Maybe full days? You decide,..
  • 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. How to write a test (2) Bug: bug1234.phpt Feature: <function>_basic.phpt Error: <function>_error.phpt Global: <extension><nr>.phpt∂ NAMING CONVENTIONS
  • 6. How to write a test (3) --TEST-- --CREDITS-- --SKIPIF-- --FILE-- --EXPECT-- / --EXPECTF-- --CLEAN--∂ PHPT SECTIONS
  • 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. 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. How to run your tests (1)∂ HTTP://TESTFEST.ENRISE.COM
  • 10. How to run your tests (2)
  • 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. 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. More information When in doubt, ask one us to help you!∂ WE ARE HERE TO HELP!
  • 14. ∂ LET’S SQUASH SOME BUGS