Lecture 6 - Software Testing
Lecture 6 - Software Testing
1
Referred Books
• Software Engineering
▪ Ian Sommerville
2
Software Testing
3
Testing Goals
4
Validation and Defect Testing
5
A Sample Test Case
6
An input-output model of program testing
7
Testing Goals
❖ Immediate Goals
❖ Long-term Goals
❖ Post-Implementation
Goals
https://www.geeksforgeeks.org/
goals-of-software-testing/
8
Software Testing Terminology
9
Software Testing Terminology
10
Verification Vs. Validation
Verification Validation
1. Are we building the product Are we building the right
right? product?
2. Checks whether an artifact Checks the final product
conforms to its previous artifact against specification
3. Done by developer Done by Tester
4. Involves reviews, inspections, Involves system testing
unit testing and integration testing
5. Comprises of both Static and Comprises of only Dynamic
Dynamic procedures procedures
11
Verification and Validation
13
Software Faults, Errors & Failures
14
A Concrete Example
15
A Concrete Example
Fault: Should start
searching at 0, not 1
17
Differences between Static and Dynamic Testing
✧ Inspection Team:
▪ Moderator
▪ Programer
▪ Program’s Designer
▪ Test Specialist
✧ Moderator’s Duties:
▪ Distributing materials for, and scheduling, the inspection session.
▪ Leading the session.
▪ Recording all errors found.
▪ Ensuring that the errors are subsequently corrected
Inspection (Cont.)
✧ Inspection Agenda:
▪ The programmer narrates, statement by statement, the logic of the
program. And other participants raise questions
▪ The program is analyzed with respect to checklists of historically
common programming errors
✧ Human Agenda:
▪ The testing group must adopt an appropriate attitude to make the
inspection process effective
▪ The programmer must take the process in a positive and constructive
way
Dynamic Testing (Software Testing)
22
Inspection and Testing
23
Advantages of Inspections over Testing
✧ 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.
✧ Incomplete versions of a system can be inspected without additional
costs
✧ Compared with dynamic testing, typical defects that are easier and
cheaper to find and fix through static testing include:
● Requirement defects
● Design defects
● Coding defects
● Deviations from standards
● Incorrect interface specifications
● Gaps or inaccuracies in test basis traceability or coverage
✧
24
A model of the software testing process
25
Testing Methods
26
Selection of test cases
27
Testing Methods
❖ White Box Testing
▪ focuses on the internal specifications (e.g., algorithms, logic paths) of
software units (i.e., modules)
▪ performed by developers
28
White box testing
● Statement coverage
○ This designs test cases that execute every statement in a unit (i.e., module) at
least once.
● Decision condition coverage (branch coverage)
○ This designs test cases that execute TRUE/FALSE at least once for every
“decision condition” (i.e., branch) in a unit (i.e., module).
● Condition coverage
○ This designs test cases that execute TRUE/FALSE at least once for every
“condition” used as a decision condition.
● Decision condition / condition coverage
○ This designs test cases that fulfill both decision condition coverage (i.e.,
branch coverage) and condition coverage.
● Multiple-condition coverage
○ This designs test cases that include every combination of TRUE/FALSE for
every condition.
29
White box testing
30
Black box testing
● Equivalence Partitioning
31
Equivalence Partitioning
▪ We want to select the ‘‘right’’ subset, that is, the subset with the
highest probability of finding the most errors.
32
Equivalence Partitioning
33
Identifying the Equivalence Classes
34
Practice
35
Practice
36
Boundary Value Analysis
❖ General Guidelines:
➢ If an input condition specifies a range of values, write test cases for the
ends of the range, and invalid-input test cases for situations just
beyond the ends.
➢ If an input condition specifies a number of values, write test cases for
the minimum and maximum number of values and one beneath and
beyond these values.
37
Example
For example, say a program specification states that the program
accepts 4 to 8 inputs which are five-digit integers greater than
10,000. You use this information to identify the input partitions and
possible test input values.
38
General Testing Guidelines
39
Stages of Testing
40
Testing Procedure
✧ Manual testing
A tester runs the program with some test data and compares the results
to their expectations.
✧ Automated testing
The tests are encoded in a program that is run each time the system
under test (SUT) is to be tested
Faster than manual testing
Testing can never be completely automated
Practically impossible to test systems that depend on how things look
(UI)
41
Automated Testing
An automated test has three parts:
1. A setup part, where you initialize the system with the test
case, namely the inputs and expected outputs
2. A call part, where you call the object or method to be tested.
3. An assertion part, where you compare the result of the call
with the expected result. If the assertion evaluates to true, the
test has been successful; if false, then it has failed.
42
Automated Testing
43
Stages of Testing
❖ Development testing
▪ where the system is tested during development to discover bugs and
defects.
▪ Done by System designers and programmers
❖ Release testing
▪ a complete version of the system is tested before it is released to users
▪ Done by a separate testing team
❖ User testing
▪ users or potential users of a system test the system in their own
environment
44
Development Testing
46
Object Class Testing
47
Component Testing
❑ After individual objects have been unit tested in isolation, they
are combined (integrated) to form “composite components”.
❑ The functionalities of these objects are accessed through their
defined component interfaces
❑ Component testing focuses on showing that the component
interface behaves according to its specification
48
Interface Testing
✧ Parameter interfaces
▪ data are passed from one component to another.
✧ Shared memory interfaces
▪ a block of memory is shared between components.
✧ Procedural interfaces
▪ one component encapsulates a set of procedures that can be
called by other components.
✧ Message passing interfaces
▪ one component requests a service from another component by
passing a message to it.
Interface Errors
✧ Interface misuse
▪ A calling component calls some other component and makes an
error in the use of its interface. Example: wrong type of
parameters or be passed in the wrong order, or the wrong number
of parameters may be passed
✧ Interface misunderstanding
▪ A calling component misunderstands the specification of the
interface of the called component and makes assumptions about
its behavior .
✧ Timing errors
▪ The called and calling components operate at different speeds
and out-of-date information is accessed.
Interface Testing Guidelines