Your SlideShare is downloading. ×
Back to basics - PHPUnit
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Back to basics - PHPUnit

1,903
views

Published on

An introduction talk to unit testing concept and PHPUnit

An introduction talk to unit testing concept and PHPUnit

Published in: Technology

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,903
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
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?