Back to basics - PHPUnit

  • 1,881 views
Uploaded on

An introduction talk to unit testing concept and PHPUnit

An introduction talk to unit testing concept and PHPUnit

More in: Technology
  • 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
1,881
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
18
Comments
0
Likes
3

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

Transcript

  • 1. Back to basics Sebastian Marek
  • 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. 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. 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. Benefits● Facilitates change● Simplifies integration● Living documentation● Early design
  • 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. Managing tests
  • 8. Writing tests● assertions● testing exceptions● data providers● test dependencies● test fixtures● stubs● mock objects
  • 9. Logging results● verbose mode● testdox format● test results● code coverage results
  • 10. PHPUnit configuration file● bootstrap file● process isolation● including and excluding files for code coverage● logging
  • 11. Resources● http://www.phpunit.de/manual/current/en/index.html
  • 12. Q&A?