Back to basics            Sebastian Marek
What is a unit test?In computer programming, unit testing is a method bywhich individual units of source code are tested t...
For whom?Unit tests are typically written and run by softwaredevelopers to ensure that code meets its design andbehaves as...
What for?The goal of unit testing is to isolate each part of theprogram and show that the individual parts are correct. Au...
Benefits● Facilitates change● Simplifies integration● Living documentation● Early design
Installing PHPUnit#> pear channel-discover pear.phpunit.de#> pear channel-discover components.ez.no#> pear channel-discove...
Managing tests
Writing tests● assertions● testing exceptions● data providers● test dependencies● test fixtures● stubs● mock objects
Logging results● verbose mode● testdox format● test results● code coverage results
PHPUnit configuration file● bootstrap file● process isolation● including and excluding files for code coverage● logging
Resources●   http://www.phpunit.de/manual/current/en/index.html
Q&A?
Upcoming SlideShare
Loading in …5
×

Back to basics - PHPUnit

2,478 views

Published on

An introduction talk to unit testing concept and PHPUnit

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,478
On SlideShare
0
From Embeds
0
Number of Embeds
140
Actions
Shares
0
Downloads
24
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Back to basics - PHPUnit

  1. 1. Back to basics Sebastian Marek
  2. 2. What is a unit test?In computer programming, unit testing is a method bywhich individual units of source code are tested todetermine if they are fit for use. A unit is the smallesttestable part of an application. http://en.wikipedia.org/wiki/Unit_testing
  3. 3. For whom?Unit tests are typically written and run by softwaredevelopers to ensure that code meets its design andbehaves as intended. http://en.wikipedia.org/wiki/Unit_testing
  4. 4. What for?The goal of unit testing is to isolate each part of theprogram and show that the individual parts are correct. Aunit test provides a strict, written contract that the pieceof code must satisfy. As a result, it affords severalbenefits. Unit tests find problems early in thedevelopment cycle. http://en.wikipedia.org/wiki/Unit_testing
  5. 5. Benefits● Facilitates change● Simplifies integration● Living documentation● Early design
  6. 6. Installing PHPUnit#> pear channel-discover pear.phpunit.de#> pear channel-discover components.ez.no#> pear channel-discover pear.symfony-project.com#> pear install phpunit/PHPUnit#> phpunit –versionPHPUnit 3.5.11 by Sebastian Bergmann.
  7. 7. Managing tests
  8. 8. Writing tests● assertions● testing exceptions● data providers● test dependencies● test fixtures● stubs● mock objects
  9. 9. Logging results● verbose mode● testdox format● test results● code coverage results
  10. 10. PHPUnit configuration file● bootstrap file● process isolation● including and excluding files for code coverage● logging
  11. 11. Resources● http://www.phpunit.de/manual/current/en/index.html
  12. 12. Q&A?

×