ST Chapter2
ST Chapter2
“ Add31 tháng
your 08 năm
company 2023
slogan ”
SOFTWARE TESTING
Chapter 2.
Software Testing Techniques
Reviews etc.
Behavioural
Inspection Static Analysis
Inspection:
• formal individual and group checking, using sources and
standards, according to generic and specific rules and
checklists, using entry and exit criteria, Leader must be
trained & certified, metrics required
Reviews in general 1
• Objectives / goals
• validation & verification against
specifications & standards
• achieve consensus (excluding Inspection)
• process improvement (ideal, included in
Inspection)
Reviews in general 2
• Activities
• planning
• overview / kick-off meeting (Inspection)
• preparation / individual checking
• review meeting (not always)
• follow-up (for some types)
• metrics recording & analysis (Inspections
and sometimes reviews)
Reviews in general 3
• Roles and responsibilities
• Leader / moderator - plans the review /
Inspection, chooses participants, helps &
encourages, conducts the meeting,
performs follow-up, manages metrics
• Author of the document being reviewed /
Inspected
• Reviewers / Inspectors - specialised fault-
finding roles for Inspection
• Managers - excluded from some types of
review, need to plan project time for review
/ Inspection
• Others: e.g. Inspection/ review Co-ordinator
Reviews in general 4
• Deliverables
• Changes (edits) in review product
• Change requests for source documents (predecessor
documents to product being reviewed / Inspected)
• Process improvement suggestions
• to the review / Inspection process
• to the development process which produced the
product just reviewed / Inspected
• Metrics (Inspection and some types of review)
Reviews in general 5
• Pitfalls (they don’t always work!)
• lack of training in the technique (especially
Inspection, the most formal)
• lack of or quality of documentation - what is
being reviewed / Inspected
• Lack of management support - “lip service”
- want them done, but don’t allow time for
them to happen in project schedules
• Failure to improve processes (gets
disheartening just getting better at finding
the same thing over again)
Inspection is more and better
• entry criteria • process improvement
• training • exit criteria
• optimum checking rate • quantified estimates of
• prioritising the words remaining major faults
• standards per page
At first glance ..
100 pages?
Checking Size
Rate
2 hrs? Time
Optimum:
1 page*
per hour
Checking Size
Rate
80% of function
by 20% of code
20% of function
by 80% of code
System testing
distributed over
this line
Contract acceptance testing
• Contract to supply a software system
• agreed at contract definition stage
• acceptance criteria defined and agreed
• may not have kept up to date with changes
• Contract acceptance testing is against the
contract and any documented agreed changes
• not what the users wish they had asked for!
• this system, not wish system
Alpha and Beta tests: similarities
• Testing by [potential] customers or representatives of
your market
• not suitable for bespoke software
• When software is stable
• Use the product in a realistic way in its operational
environment
• Give comments back on the product
• faults found
• how the product meets their expectations
• improvement / enhancement suggestions?
Alpha and Beta tests: differences
• Alpha testing
• simulated or actual operational testing at an in-house site
not otherwise involved with the software developers (i.e.
developers’ site)
• Beta testing
• operational testing at a site not otherwise involved with
the software developers (i.e. testers’ site, their own
location)
Software testing techniques under the language of V&V:
• Verification
. "Are we building the product right”.
. What the testing technique is often used?
• Validiation
. "Are we building the right product”.
. What the testing technique is often used?
Black-Box testing technique
The tester’s dilemma
• We can’t test everything.
• No single approach, method, or technique is
sufficient to test a program adequately
• So, which subsets of tests do we choose
• …expose most defects
• …achieve high coverage
• …reduce exposure to risk
• …provide necessary information
Functional testing techniques
• Test design patterns designed to identify bugs
that negatively impact functionality or
behavior of software
• Derived from common mistakes or errors in
computer programming
• Techniques are useful in identifying specific
categories of bugs, but will not identify all
bugs or all types of bugs
Common functional testing techniques
• Error guessing / exploratory testing
• Equivalence partitioning
• Boundary value analysis
• Decision tables
• Combinatorial analysis
• State models
• Use cases / scenario testing
Lesson Roadmap
• Exploratory testing / error guessing
• Use intuition, experience, and knowledge to
identify bugs
• State benefits and limitations of exploratory
testing / error guessing
• Equivalence Class Partitioning (ECP)
Lesson 1 – Exploratory testing
• Exploratory testing is described as concurrent
learning, test design, and execution
• Dynamic tests based on the tester’s
experience and intuition executed during
runtime at the system level
• Effectiveness is dependent on the tester's skill,
intuition, and knowledge of the product
Exploratory Testing / Error Guessing
• When to use
• Learn product or features
• Broad scope – no distinct separate test
cases
• Helps identify “what if” scenarios
Exercise 1: Triangle problem
• The objective of this exercise is to:
• Test the triangle program against the stated requirements
• In this exercise you will:
• Define tests using you current experience, knowledge and
skills (exploratory testing)
• This is important because:
• This sets a baseline and allows you to evaluate yourself as
you learn how to apply functional and structural
techniques
Lesson Roadmap
• Exploratory testing / error guessing
• Equivalence Class Partitioning (ECP)
• Separate input and outputs into equivalent
domain spaces
• Define a subset of tests using data from
equivalent data sets
Basic principles
• Separate input or expected output conditions
into sets and test at least one value from each
set.
• Rationale – if each element in a class of values
has the exact same behavior, then the
program is likely to be constructed so that it
either succeeds or fails for all of the values in
that specific class.
Equivalence class partitioning
• In-depth analysis of input/output conditions
• 2 basic classes: Valid and Invalid
• Data grouped or partitioned by expected
results
• Primary testing focus
• Breadth of coverage (especially with
random data)
• Identifies edge cases
ECP Class subset Guidelines
• Range of values
• Numbers 1 – 10, characters A – Z, etc.
• Unique values in a group
• February 29 in a range of dates, tomato is a fruit
• Number of values
• Visa must have 14 digits
• Specific values
• Visa must start with 4, filename cannot have ‘\’
character
Equivalence Partitioning
• First-level
partitioning: Valid
vs. Invalid test cases
Valid Invalid
Equivalence Partitioning
• Partition valid and
invalid test cases
into equivalence
classes
Equivalence Partitioning
• Create a test case for
at least one value
randomly selected
from each
equivalence class
Equivalence class Definition
• Note that the examples so far focused on defining input
variables without considering the output variables.
Triangle Example
• For the “triangle problem,” we are interested in 4 questions:
• Is it a triangle?
• Is it an isosceles?
• Is it a scalene?
• Is it an equilateral?
• We may define the input test data by defining the
equivalence class through the 5 output groups:
• input sides <a, b, c> do not form a triangle
• input sides <a, b ,c> form an isosceles triangle
• input sides <a, b, c> form a scalene triangle
• input sides <a, b, c> form an equilateral triangle
• Error inputs
Triangle Equivalent Classes and Input Conditions
• Error Input
• a <= 0 || b <= 0 || c <= 0
• Not triangle
Error Input
• a + b <= c || b + c <= a || a + c <= b
Equilateral
• Equilateral
• a == b && b == c Isosceles
Not
• Scalene Triangle
• a != b && b != c && a != c
Scalene
• Isosceles
• (a == b && b != c) || (b == c && c != a) ||
(a == c && a != b)
* The question: “Can we continue the equivalent partitioning for above partitions? And
how?”
Triangle Equivalent Classes and Input Conditions
• Error Input
• a <= 0
• b <= 0
• c <= 0
• Invalid
• a + b <= c
• b + c <= a
• a + c <= b
• Equilateral
• a == b && b == c
• Scalene
• a != b && b != c && a != c
• Isosceles
• (a == b && b != c)
• (b == c && c != a)
• (a == c && a != b)
Evaluation for Exercise 1
Each “yes” gives you one point
• Do you have a test case for an equilateral triangle?
• Do you have a test case for an isosceles triangle? (must
be a triangle, not, e.g. (2,2,4))
• Do you have a test case for an admissible scalene
triangle (must be a real triangle, not, e.g. (1,2,3))
• Do you have at least three test cases for isoscele
triangles, where all permutations of sides are
considered? (e.g. (3,3,4), (3,4,3), (4,3,3))
• Did you state for each test case the expected result?
Evaluation for Exercise 1 (con’d)
• Do you have a test case with one side zero?
• Do you have a test case with negative values?
• Do you have a test case where the sum of two sides
equals the third one? (e.g. (1,2,3))
• Do you have at least three test cases for such non-
triangles, where all permutations of sides are
considered? (e.g. (1,2,3), (1,3,2), (3,1,2))
• Do you have a test case where the sum of the two
smaller inputs is greater than the third one?
• Do you have at least three such test cases?
Evaluation for Exercise 1 (con’d)
• Do you have the test case (0,0,0)?
• Do you have test cases with very large integers (maxint)?
• Do you have a test case with non-integer values? (e.g., real
numbers, hex values, strings,…)
• Do you have a test case where 2 or 4 inputs are provided?
Exercise (Lab) 1
Next Date Problem
Next Date program takes 3 inputs representing the month, day,
and year between 1/1/1900 and 12/31/3000 and calculates
the next calendar date. The program only allows the user to
input only positive integers.
Let’s do:
1. Define equivalence classes , test conditions (of input data)
using equivalent partitioning technique;
2. Design a set of test cases based on defined equivalence
classes.
Lesson Key Points
• Relatively small number of test cases
• Provides a sense of complete coverage
• Helps reduce redundancy
• Special case situations
• Requires in-depth system knowledge to be
most effective (especially in regard to unique
values in a set)
Module summary
• Today we discussed:
• Exploratory testing / error guessing
approach to software testing
• Equivalence class partitioning technique to
identify sets of ‘equivalent data’ and create
a subset of tests based on data sets rather
than specific data