SFE 4030. Lecture 2.foundations of Software Testing
SFE 4030. Lecture 2.foundations of Software Testing
Quality Assurance
Lecture 2:
Foundations of
Software Testing
SFE 4030 1
Terminology:
Failure
2
3
Windows failure leads to “blue screen of death”.
4
Terminology: Defect /
Fault
“Flaw in component or system
that can cause the component or system
to fail to perform its required function”
Synonym: Fault
5
6
Fault in Apple’s Secure Socket Layer code
7
https://avandeursen.com/2014/02/22/gotofail-
security/
Terminology:
Error
“A human action
that produces an incorrect result”
Synonym: Mistake
8
Faults, Failures, and
Bugs
• Failure:
• Manifested inability of a system
to perform required function.
• Defect (fault):
• missing / incorrect code
“bug”
• Error (mistake)
• human action producing fault
• And thus:
• Testing: Attempt to trigger
failures
• Debugging: Attempt to find faults given a failure
9
Principles of Testing
#1
• Testing shows the presence of defects
10
Principles of Testing #2:
Exhaustive Testing is ….....
……….
11
Principle #2: Exhaustive Testing is
Impossible • A simple program: 3 inputs, 1 output
• a,b,c: 32 bit integers
• trillion test cases / s.
All oceans dry
All plants dead Tests done (2.5 bill. y)
26
Principles of Testing #3: Test
Early
• Start testing as early as possible
• To let tests guide design
• To get feedback as early as possible
• To find bugs when they are cheapest to fix
• To find bugs when have caused least damage
13
Faults can be introduced
at any moment in the
software development
process
14
Cost to Repair:
Early Discovery Pays
Off 16
4
2
1
Clustered
• “Hot” components requiring frequent
change, bad habits, poor developers,
tricky logic, business uncertainty,
innovative, size, ….
30
Principles of Testing #5:
Is there one best test method for my project?
• Testing is context-dependent
18
Principles of Testing #7
Absence-of-errors
Fallacy
There is more to success than absence of errors
https://embeddedartistry.com/blog/2019/2/5/beyond-continual-improvement 33
Revisiting the
Principles?
1. Testing cannot show absence of bugs
2. Exhaustive testing is impossible
3. Testing needs to start early
4. Defects tend to be clustered
5. Pesticide paradox yields test methods ineffective
6. Testing is context-dependent
7. There is more to quality than absence of defects
20
Psychology of
Testing
• We are all biased
21
Cognitive
Bias
• “System 1”: Fast, instinctive,
emotional.
• "System 2”: slower, more
deliberative, and more logical.
22
Example of Cognitive
Bias
• “What You See is All There Is” (WYSIATI)
• Being satisfied with the evidence you see.
23
ACM Software EngineeringCode of
Ethics
1. PUBLIC - Software engineers shall act consistently with the public interest.
2. CLIENT AND EMPLOYER - Software engineers shall act in a manner that is in the best
interests of their client and employer consistent with the public interest.
3. PRODUCT - Software engineers shall ensure that their products and related
modifications meet the highest professional standards possible.
4. JUDGMENT - Software engineers shall maintain integrity and independence
in their professional judgment.
5. MANAGEMENT - Software engineering managers and leaders shall subscribe to and
promote an ethical approach to the management of software development and
maintenance.
6. PROFESSION - Software engineers shall advance the integrity and reputation of the
profession consistent with the public interest.
7. COLLEAGUES - Software engineers shall be fair to and supportive of their colleagues.
8. SELF - Software engineers shall participate in lifelong learning regarding the practice
of their profession and shall promote an ethical approach to the practice of the 24
profession.
25
https://www.acm.org/code-of-ethics
26
https://www.acm.org/code-of-ethics
Question!
A. Acceptance Testing
B. Integration Testing
C. System Testing
D. Unit Testing
27
Question!
A. Acceptance Testing
B. Integration Testing
C. System Testing
D. Unit Testing
28
Software Life Cycle
• Period of time that
• begins when a software system is conceived
• ends when the system is no longer available for use.
29
30
Verification vs validation
Verification:
"Are we building the product right”.
The software should conform to its specification.
Validation:
"Are we building the right product”.
The software should do what the user really requires.
33
V & V confidence
• Software purpose
• The level of confidence depends on how critical the software is to an
organisation.
• User expectations
• Users may have low expectations of certain kinds of software.
• Marketing environment
• Getting a product to market early may be more important than finding
defects in the program.
Validation and defect testing
Defect testing
To discover faults or defects in the software where its behavior is
incorrect or not in conformance with its specification
A successful test is a test that makes the system perform
incorrectly and so exposes a defect in the system.
They have been shown to be an effective technique for discovering program errors.
During testing, errors can mask (hide) other errors. Because inspection is a
static process, you don’t have to be concerned with interactions between
errors.
• The performance of a system depends on how the parts fit, not how
they act taken separately
https://embeddedartistry.com/blog/2019/2/5/beyond-continual-improvement
45
Test
Types
46
Test
Types
• Testing of Function
• Functional testing, black box testing
60
Testing As Software
Evolves
• The norm in software development!
• Many updates per day in modern web apps
• Current cars (wireless updates)
• Formula 1 (every two weeks)
• Aircraft (737 max compatibility)
• Impact analysis:
• Determine which parts are affected by change
• Conduct regression testing for those.
62
Key Points
• Software development follows life cycle activities
• The V-Model helps reason about verification vs validation,
decomposition vs composition, and construction vs testing.
• We test at different levels
• Different test types target specific test objectives
• Iterative projects do continuous regression testing and thus maximize
test automation
64