3. Agenda
Types of Testing
Unit Testing - What, Why & Who?
Code Coverage
Guideline for Unit Testing
Demo by using PHP-Unit.
Questions & Answers
4. Types of Testing
White Box (or glass box) Testing
• Unit Testing
• Integration Testing
Black Box Testing (Behavioral Testing)
• Incorrect or missing functions
• Interface, Initialization and termination errors
• Errors in data structures or external database access
• Behavior or performance errors
Gray Box Testing ( Code + Behavior)
5. Unit Testing – What, Why & Who?
What is Unit Testing?
• Test individual units/components of a software/system
• Validate each unit of the software performs as designed
• Source code is meeting requirement at its best.
Why do we use it?
• Functional correctness and completeness
• Error handling
• Check input parameters (Input values)
• Correctness of return values (output data)
• Optimizing performance and algorithm
Who does it?
• Typically written and run by software developers.
8. Guidelines
Unit tests must be small and fast
Fully automated
Simple to run
Measure the tests
Fix failing tests immediately
Keep tests independent
Name tests properly ( e.g testSaveData(),
testUpdateData() )