Introduction to OO Program Design
Software College of SCU
Instructor: Shu Li
Email: [email protected]

2
Unit 2.1 Implementing Classes
•
2.1.4 Unit Testing
–
2.1.4.1 Overview of Software Testing
–
2.1.4.2 Software Testing Methods
–
2.1.4.3 Software Test Types
–
2.1.4.4 Unit Test

3
2.1.4 Unit Testing
•
2.1.4.1 Overview of Software Testing
•
2.1.4.2 Software Testing Methods
•
2.1.4.3 Software Test Types
•
2.1.4.4 Unit Test

4
2.1.4.1 Overview of Software Testing
•
Purpose of Software Testing
•
Role of Testers
•
Truths and Realities

5
Software Testing
•
Any activity designed to evaluate an attribute or
capability of a program to determine that it meets required
standards.

6
Purpose of Software Testing
•
Measure Quality
–
Validation: Prove it works (Do the right thing)
–
Verification: Do it right
•
Provide information
–
To development and management
–
For risk evaluation
•
Watching the process not just the product

7
Software Quality
•
Doing the right things right at the right time
•
Conformance to applicable standards
–
Customer focus
•
Features vs. Flaws
–
Engineering focus
•
Maintainability, sustainability, testability, etc.
•
Quality is defined as conformance to requirements, not as
“goodness” or “elegance”
•
Quality also means “meet customer needs”

8
Role of Testers
•
Find Bugs
•
Break Software
•
Keep Developers Honest
•
Defect Prevention
•
Quality Measurement
•
Drive quality upstream
•
Customer focus
•
Goal: ensure the quality

9
Truths and Realities
•
The earlier a bug is fixed, the less costly it is.
–
Before code review
–
By code review
–
By testing
–
By Beta testers
–
After product is released
•
Prevention vs. Detection
–
“The mere act of designing a test is a powerful bug
preventer”

10
Truths and Realities
•
Thorough Testing vs. Risk-based testing
–
Thorough Testing: testing for everything
–
Risk-based Testing
•
Identify and analyze risks to enable informed and calculated
decisions
•
Look for the best use of test resource
•
Risks can be categorized by severity and likelihood.

11
2.1.4 Unit Testing
•
2.1.4.1 Overview of Software Testing
•
2.1.4.2 Software Testing Methods
•
2.1.4.3 Software Test Types
•
2.1.4.4 Unit Test

12
Software Testing Methods
•
Black-box Testing
•
White-box Testing
•
Risk-based Testing

13
Black-box Testing
•
Doesn’t require explicit knowledge of the internal
structure of the system
•
Primarily focuses on functional requirements
–
User-perspective
–
Validates the spec
Input
Output

14
White-box testing
•
Requires knowledge of the internal structure
•
Primarily focuses on code coverage ( o
)
–
e.g. write tests to “cover” internal paths
–
Good for testing individual functions
–
Developer’s tests
Input
Output

15
Risk-based Testing
•
Used to determine:
–
What to test
–
Test priority
–
Test coverage

16
Risk-based Testing

17
Risk-based Testing
•
Two basic factors for determining risk:
–
Impact to the customer
–
Probability of customer experiencing issues
