Professional Documents
Culture Documents
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 1 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 2
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 3 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 4
An informal specification:
Category partition (manual steps)
check configuration
1. Decompose the specification into independently Check Configuration
testable features
– for each feature identify • Check the validity of a computer configuration
parameters
•
• The parameters of check-configuration are:
• environment elements
– for each parameter and environment element identify – Model
elementary characteristics (categories) – Set of components
2. Identify relevant values
– for each characteristic (category) identify (classes of) values
• normal values
• boundary values
• special values
• error values
3. Introduce constraints
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 5 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 6
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 7 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 8
Step1: Identify independently testable Step 1: Identify independently testable units
units and categories
Parameter Model
• Choosing categories – Model number
– no hard-and-fast rules for choosing categories – Number of required slots for selected model (#SMRS)
– not a trivial task! – Number of optional slots for selected model (#SMOS)
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 9 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 10
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 11 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 12
Step 2: Identify relevant values: Component Step 2: Identify relevant values: Database
Correspondence of selection with Number of optional components
model slots with non empty selection Number of models in database (#DBM)
Omitted slots 0 0
Extra slots
< #SMOS 1
Mismatched slots
= #SMOS
Complete correspondence Many
Number of required components with Optional component selection
Some defaults
Number of components in database (#DBC)
non empty selection
0 All valid 0
< number required slots " 1 incompatible with slots 1
= number required slots " 1 incompatible with another
Many
selection
Required component selection
" 1 incompatible with model
Some defaults
All valid " 1 not in database Note 0 and 1 are unusual (special) values. They might cause
" 1 incompatible with slots unanticipated behavior alone or in combination with particular
" 1 incompatible with another selection values of other parameters.
" 1 incompatible with model
" 1 not in database
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 13 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 14
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 15 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 16
Example - Step 3: error constraint Step 3: property constraints
Model number
Malformed [error] constraint [property] [if-property] rule out invalid
Not in database [error]
Valid
combinations of values
Correspondence of selection with model slots [property] groups values of a single parameter to identify
Omitted slots [error]
Extra slots [error]
subsets of values with common properties
Mismatched slots [error] [if-property] bounds the choices of values for a category
Complete correspondence
Number of required comp. with non empty selection
that can be combined with a particular value selected
0 [error] for a different category
< number of required slots [error]
Example
Required comp. selection
" 1 not in database [error] Error constraints combine
Number of models in database (#DBM) reduce test suite Number of required comp. with non empty selection = number required slots
0 [error] [if RSMANY]
Number of components in database (#DBC) from 314.928 to only with
0 [error] 2.711 test cases Number of required slots for selected model (#SMRS) = Many [Many]
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 17 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 18
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 19 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 20
Example - Step 3: single constraints Check configuration – Summary
Parameter Component
Parameter Model
Number of required slots for selected model (#SMRS) • Model number
• Correspondence of selection with model slots
– Omitted slots [error]
– Malformed [error]
0 [single] – Extra slots [error]
– Not in database [error] – Mismatched slots [error]
1 [property RSNE] [single] – Valid – Complete correspondence
• Number of required slots for selected model (#SMRS) • # of required components (selection ! empty)
Number of optional slots for selected model (#SMOS) – 0 [single] – 0 [if RSNE] [error]
– 1 [property RSNE] [single] – < number required slots [if RSNE] [error]
0 [single] – Many [property RSNE] [property RSMANY] – = number required slots [if RSMANY]
• Required component selection
1 [single] [property OSNE] • Number of optional slots for selected model (#SMOS)
– Some defaults [single]
– 0 [single]
– All valid
Required component selection – 1 [property OSNE] [single] – " 1 incompatible with slots
– Many [property OSNE] [property OSMANY] – " 1 incompatible with another selection
Some default [single] – " 1 incompatible with model
Environment Product data base – " 1 not in database [error]
Optional component selection • Number of models in database (#DBM) • # of optional components (selection ! empty)
– 0
Some default [single] –
–
0
1
[error]
[single]
– < #SMOS [if OSNE]
– = #SMOS [if OSMANY]
Number of models in database (#DBM) •
– Many
Number of components in database (#DBC)
• Optional component selection
– Some defaults [single]
1 [single] – 0 [error] – All valid
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 21 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 22
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 23 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 24
Pairwise combinations: 17 test cases
Example: Display Control Language Color Display Mode Fonts Screen Size
English Monochrome Full-graphics Minimal Hand-held
No constraints reduce the total number of combinations English Color-map Text-only Standard Full-size
text-only French Standard Color-map Laptop Spanish Color-map Limited-bandwidth Minimal Hand-held
Spanish 16-bit Full-graphics Standard Laptop
limited- Spanish Document- 16-bit Full-size Spanish True-color Text-only - Hand-held
bandwidth loaded Portuguese - - Monochrome Text-only
Portuguese True-color Portuguese Color-map - Minimal Laptop
Portuguese 16-bit Limited-bandwidth Document-loaded Hand-held
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 27 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 28
Next ... Catalog based testing
• Deriving value classes requires human judgment
• Category-partition approach gives us ... • Gathering experience in a systematic collection can:
– Separation between (manual) identification of – speed up the test design process
parameter characteristics and values and – routinize many decisions, better focusing human effort
(automatic) generation of test cases that combine – accelerate training and reduce human error
them • Catalogs capture the experience of test designers by
– Constraints to reduce the number of combinations listing important cases for each possible type of
variable
• Pairwise (or n-way) testing gives us ... – Example: if the computation uses an integer variable a catalog
– Much smaller test suites, even without constraints might indicate the following relevant cases
• The element immediately preceding the lower bound
• (but we can still use constraints)
• The lower bound of the interval
• We still need ... • A non-boundary element within the interval
• The upper bound of the interval
– Help to make the manual step more systematic • The element immediately following the upper bound
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 29 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 30
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 31 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 32
An informal specification: input/output Step 1: Identify simple elements
[INPUT] encoded: string of characters (the input CGI sequence) Pre-conditions: conditions on inputs that must be
can contain:
– alphanumeric characters true before the execution
– the character + – validated preconditions: checked by the system
– the substring %xy, where x and y are hexadecimal digits
is terminated by a null character – assumed preconditions: assumed by the system
[OUTPUT] decoded: string of characters (the plain ASCII characters Post-conditions: results of the execution
corresponding to the input CGI sequence)
– alphanumeric characters copied into output (in corresponding Variables: elements used for the computation
positions)
– blank for each + character in the input Operations: main operations on variables and
– single ASCII character with value xy for each substring %xy inputs
[OUTPUT] return value cgi_decode returns
– 0 for success Definitions: abbreviations
– 1 if the input is malformed
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 33 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 34
Step 1: cgi_decode (pre and post) Step 1: cgi_decode (var, def, op.)
PRE 1 (Assumed) input string encoded null-terminated string of chars VAR 1 encoded: a string of ASCII characters
PRE 2 (Validated) input string encoded sequence of CGI items VAR 2 decoded: a string of ASCII characters
POST 1 if encoded contains alphanumeric characters, they are copied VAR 3 return value: a boolean
to the output string DEF 1 hexadecimal characters, in range ['0' .. '9', 'A' .. 'F', 'a' .. 'f']
POST 2 if encoded contains characters +, they are replaced in the DEF 2 sequences %xy, where x and y are hexadecimal characters
output string by ASCII SPACE characters
DEF 3 CGI items as alphanumeric character, or '+', or CGI hexadecimal
POST 3 if encoded contains CGI hexadecimals, they are replaced by
OP 1 Scan encoded
the corresponding ASCII characters
POST 4 if encoded is processed correctly, it returns 0
POST 5 if encoded contains a wrong CGI hexadecimal (a substring xy,
where either x or y are absent or are not hexadecimal digits,
cgi_decode returns 1
POST 6 if encoded contains any illegal character, it returns 1
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 35 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 36
Step 2: Derive initial set of test case specs
Step 2: cgi_decode (tests from Pre)
• Validated preconditions: PRE 2 (Validated) the input string encoded is a sequence of CGI items
– simple precondition (expression without operators) – TC-PRE2-1: encoded is a sequence of CGI items
• 2 classes of inputs: – TC-PRE2-2: encoded is not a sequence of CGI items
– inputs that satisfy the precondition
POST 1 if encoded contains alphanumeric characters, they are copied in
– inputs that do not satisfy the precondition
the output string in the corresponding position
– compound precondition (with AND or OR): – TC-POST1-1: encoded contains alphanumeric characters
• apply modified condition/decision (MC/DC) criterion – TC-POST1-2: encoded does not contain alphanumeric characters
• Assumed precondition: • POST 2 if encoded contains characters +, they are replaced in the
– apply MC/DC only to “OR preconditions” output string by ASCII SPACE characters
• Postconditions and Definitions : – TC-POST2-1: encoded contains character +
– if given as conditional expressions, consider conditions as if – TC-POST2-2: encoded does not contain character +
they were validated preconditions
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 37 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 38
Step 2: cgi_decode (tests from Post) Step 2: cgi_decode (tests from Var)
POST 3 if encoded contains CGI hexadecimals, they are replaced by VAR 1 encoded: a string of ASCII characters
the corresponding ASCII characters VAR 2 decoded: a string of ASCII characters
– TC-POST3-1 Encoded: contains CGI hexadecimals VAR 3 return value: a boolean
– TC-POST3-2 Encoded: does not contain a CGI hexadecimal DEF 1 hexadecimal characters, in range ['0' .. '9', 'A' .. 'F', 'a' .. 'f']
POST 4 if encoded is processed correctly, it returns 0 DEF 2 sequences %xy, where x and y are hexadecimal characters
POST 5 if encoded contains a wrong CGI hexadecimal (a substring xy, DEF 3 CGI items as alphanumeric character, or '+', or CGI hexadecimal
where either x or y are absent or are not hexadecimal digits,
OP 1 Scan encoded
cgi_decode returns 1
– TC-POST5-1 Encoded: contains erroneous CGI hexadecimals
POST 6 if encoded contains any illegal character, it returns 1
– TC-POST6-1 Encoded: contains illegal characters
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 39 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 40
Step 3: Apply the catalog A simple catalog (part I)
• Boolean
– True in/out
• Scan the catalog sequentially – False in/out
• For each element of the catalog • Enumeration
– Each enumerated value in/out
– scan the specifications – Some value outside the enumerated set in
– apply the catalog entry • Range L ... U
• Delete redundant test cases – L-1 in
– L in/out
• Catalog: – A value between L and U in/out
– List of kinds of elements that can occur in a specification – U in/out
– Each catalog entry is associated with a list of generic test case – U+1 in
specifications • Numeric Constant C
– C in/out
Example:
– C –1 in
catalog entry Boolean – C+1 in
two test case specifications: true, false – Any other constant compatible with C in
Label in/out indicate if applicable only to input, output, both
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 41 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 42
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 43 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 44
Example - Step 3: entry enumeration Example - Step 3: entry enumeration
• Enumeration applies also to improper CGI hexadecimals
– Each enumerated value in/out • New test case specifications
– Some value outside the enumerated set in – TC-POST5-2 encoded terminated with %x, where x is a
hexadecimal digit
– TC-POST5-3 encoded contains %ky, where k is not a
hexadecimal digit and y is a hexadecimal digit
applies to
– TC-POST5-4 encoded contains %xk, where x is a hexadecimal
– CGI item (DEF 3) digit and k is not
• Old test case specifications can be eliminated if they
included in TC-POST1-1, TC-POST1-2,
are less specific than the newly generated cases
TC-POST2-1, TC-POST2-2, TC-POST3-1, – TC-POST3-1 encoded contains CGI hexadecimals
TC-POST3-2 – TC-POST5-1 encoded contains erroneous CGI hexadecimals
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 45 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 46
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 47 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 48
Step 3: entry sequence Step 3: entry scan
apply to
applies to Scan encoded (OP 1) and generates 17 test
encoded (VAR 1), decoded (VAR 2), and cgi-item (DEF 2) cases:
• 6 new Test Cases for each variable
• only 10 are non-redundant
• Only 6 are non-redundant:
– encoded
• empty sequence
• sequence of length one
• long sequence
– cgi-item
• % terminated sequence (subsequence with one char)
• % initiated sequence
• sequence including %xyz, with x, y, and z hexadecimals
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 49 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 50
summary of generated test cases (i/ii) Summary of generated test cases (ii/ii)
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 51 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 52
What have we got? Summary
• From category partition testing: • Requirements specifications typically begin in the form of natural
language statements
– Division into a (manual) step of identifying – but flexibility and expressiveness of natural language is an obstacle to
categories and values, with constraints, and an automatic analysis
(automated) step of generating combinations • Combinatorial approaches to functional testing consist of
– A manual step of structuring specifications into set of properties
• From catalog based testing: – An automatizable step of producing combinations of choices
– Improving the manual step by recording and using • Brute force synthesis of test cases is tedious and error prone
standard patterns for identifying significant values • Combinatorial approaches decompose brute force’ work into steps
• From pairwise testing: to attack the problem incrementally by separating analysis and
synthesis activities that can be quantified and monitored, and
– Systematic generation of smaller test suites partially supported by tools
• These ideas can be combined
(c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 53 (c) 2007 Mauro Pezzè & Michal Young Ch 11, slide 54