SlideShare a Scribd company logo
Università degli Studi dell’Aquila




L21: Black Box/Functional Testing

                                      Henry Muccini
          DISIM, University of L’Aquila
 www.henrymuccini.com, henry.muccini@univaq.it
The material in these slides may be freely reproduced and
distributed, partially or totally, as far as an explicit
reference or acknowledge to the material author is
preserved.




Partially based on material from Alex Orso, Mauro Pezze’,
and Michal Young.
AGENDA
White box testing
                                 Representative values

                Systematic vs Random Testing
                               Equivalence Partitioning

                Category Partition Method
Where is the boundary between testing and other
 (analysis/verification) methods?

  What distinguishes software testing from “other” approaches
  is execution. This requires the ability to:
   →   launch the tests on some executable version (traceability problem),
       and
   →   analyse (observe and evaluate) the results (not granted for embedded
       systems)

I am not saying testing is superior and we should disregard other
   approaches: on the contrary, testing and other methods
   should complement/support each other
Any software test campaign involves a trade-off
  between
   →   Limiting resource utilization (time, effort)
         ⇒ as few tests as possible
   →   Augmenting our confidence
         ⇒ as many tests as possible
Two research challenges:
   →   Determining a feasible and meaningful stopping rule
   →   Evaluating test effectiveness (reliability, “coverage notion”,
       ....very tough problem
BLACK BOX/FUNCTIONAL TESTING
Functional testing: Deriving test cases from program
specifications
         ─ Functional refers to the source of information used in test case
            design, not to what is tested
Also known as:
  → specification-based testing (from specifications)
  → black-box testing (no view of the code)

Functional specification = description of intended
program behavior
  →   either formal or informal

(C) 2007 MAURO PEZZÈ & MICHAL YOUNG
Exploit some knowledge to choose samples that are more
likely to include “special” or trouble-prone regions of the
input space
 → Failures are sparse in the whole input space ...
 → ... but we may find regions in which they are dense



Desirable case: Each fault leads to failures that are dense
(easy to find) in some class of inputs
 → sampling each class in the quasi-partition selects at least one
   input that leads to a failure, revealing the fault
 → seldom guaranteed; we depend on experience-based heuristics

 (C) 2007 MAURO PEZZÈ & MICHAL YOUNG
Failures are sparse
                                     Failure (valuable test case)                            ... but dense in some
                                                                      in the space of
                                                                                               parts of the space
                                     No failure                       possible inputs ...
The space of possible input values
         (the haystack)




                                     If we systematically test some               Functional testing is one way of
                                     cases from each part, we will                drawing pink lines to isolate
                                     include the dense parts                      regions with likely failures
           (C) 2007 MAURO PEZZÈ & MICHAL YOUNG
Random (uniform):
  → Pickpossible inputs uniformly
  → Avoids designer bias
         ─ A real problem: The test designer can make the same
            logical mistakes and bad assumptions as the program
            designer (especially if they are the same person)
  → But     treats all inputs as equally valuable




(C) 2007 MAURO PEZZÈ & MICHAL YOUNG
Black box testing (an introduction to)
Defects are not distributed uniformly!
•  Assume our printSum program fails if both
inputs are 0!
•  Random sampling is unlikely to choose a = 0
and b = 0!
We want bias!!
Systematic (non-uniform):
 → Try to select inputs that are especially valuable
 → Usually by choosing representatives of classes that
   are apt to fail often or not at all



Functional testing is systematic testing
Black box testing (an introduction to)
•An independently testable feature (ITF) is a
functionality that can be tested independently of other
functionalities of the software under test.
•It need not correspond to a unit or subsystem of the
software.
•For example, a file sorting utility may be capable of
merging two sorted files, and it may be possible to test
the sorting and merging functionalities separately,
even though both features are implemented by much
of the same source code.
It is recommended to devise separate test cases for
each functionality of the system, whenever possible.
The design of different tests for different
functionalities can simplify the test generation
problem
Thus, identifying functional features does not
correspond to identifying single modules at the design
level, but rather to suitably slicing the specifications to
be able to attack their complexity incrementally
Feature-based view of the system
Black box testing (an introduction to)
Functional testing uses the specification (formal or
informal) to partition the input space
  →   E.g., specification of “roots” program suggests division
      between cases with zero, one, and two real roots
Test each category, and boundaries between
categories
  →   No guarantees, but experience suggests failures often lie at
      the boundaries (as in the “roots” program)



(C) 2007 MAURO PEZZÈ & MICHAL YOUNG
•Try to select inputs that are especially valuable!
 •   Usually by choosing representatives of equivalence classes!
•Assumption: inputs in different categories behave
equivalently
 ⇒I can select one input per category
Consider a software module that is intended to accept the
name of a grocery item and a list of the different sizes the
item comes in, specified in ounces. The specifications state
that the item name is to be alphabetic characters 2 to 15
characters in length. Each size may be a value in the range
of 1 to 48, whole numbers only. The sizes are to be
entered in ascending order (smaller sizes first). A
maximum of five sizes may be entered for each item. The
item name is to be entered first, followed by a comma,
then followed by a list of sizes. A comma will be used to
separate each size. Spaces (blanks) are to be ignored
anywhere in the input.

Taken from: http://users.csc.calpoly.edu/~jdalbey/205/Resources/grocerystore.
Consider a software module that is intended to accept the
name of a grocery item and a list of the different sizes the
item comes in, specified in ounces.
The specifications state that the item name is to be alphabetic
characters 2 to 15 characters in length. Each size may be a
value in the range of 1 to 48, whole numbers only.
The sizes are to be entered in ascending order (smaller sizes
first). A maximum of five sizes may be entered for each item.
The item name is to be entered first, followed by a comma,
then followed by a list of sizes. A comma will be used to
separate each size. Spaces (blanks) are to be ignored
anywhere in the input.
Item name is alphabetic (valid)
Item name is not alphabetic (invalid)
Item name is less than 2 characters in length (invalid)
Item name is 2 to 15 characters in length (valid)
Item name is greater than 15 characters in length (invalid)
Size value is less than 1 (invalid)
Size value is in the range 1 to 48 (valid)
Size value is greater than 48 (invalid)
Size value is a whole number (valid)
Size value is a decimal (invalid)
Size value is numeric (valid)
Size value includes nonnumeric characters (invalid)
Size values entered in ascending order (valid)
Size values entered in nonascending order (invalid)
No size values entered (invalid)
One to five size values entered (valid)
More than five sizes entered (invalid)
Item name is first (valid)
…
Expected
#    Test Data                              Classes Covered
                                   Outcome

1    xy,1                          T        1,4,7,9,11,13,16,18,20,22
2    AbcDefghijklmno,1,2,3 ,4,48   T       1,4,7,9,11,13,16,18,20,23
3    a2x,1                         F       2
4    A,1                           F       3
5    abcdefghijklmnop              F       5
6    Xy,0                          F       6
7    XY,49                         F       8
8    Xy,2.5                        F       10
9    xy,2,1,3,4,5                  F       14
10   Xy                            F       15
11   XY,1,2,3,4,5,6                F       17
12   1,Xy,2,3,4,5                  F       19
13   XY2,3,4,5,6                   F       21
14   AB,2#7                        F       12
Black box testing (an introduction to)
Item name is alphabetic (valid)
Item name is not alphabetic (invalid)
Item name is less than 2 characters in length (invalid)
Item name is 2 to 15 characters in length (valid)
Item name is greater than 15 characters in length (invalid)
Size value is less than 1 (invalid)
Size value is in the range 1 to 48 (valid)
Size value is greater than 48 (invalid)
Size value is a whole number (valid)
Size value is a decimal (invalid)
Size value is numeric (valid)
Size value includes nonnumeric characters (invalid)
Size values entered in ascending order (valid)
Size values entered in nonascending order (invalid)
No size values entered (invalid)
One to five size values entered (valid)
More than five sizes entered (invalid)
Item name is first (valid)
…
The main idea is to partition the input domain of
function being tested, and then select test data for
each class of the partition.


The problem of all the existing techniques is the lack of
systematic.


Solution: the Category Partition Method
Steps:
     ITF (Independently testable feature)
     Identify parameters and Environmental conditions
        Parameters: Explicit input to the functional unit
        Environmental Conditions: Characteristics of the
        system’s state
     Find categories that characterize each parameter and
    environment condition.
     Every category should be partitioned into distinct choices
     Test Spec
Command: find (a pattern into a file)


   Syntax:       find <pattern> <file>


Function:       The find command is used to locate one or more instance of a given
pattern in a text file. All lines in the file that contain the pattern are written to
standard output. A line containing the pattern is written only once, regardless of the
number of times the pattern occurs in it.
The pattern is any sequence of characters whose length does not exceed the
maximum length of a line in the file .To include a blank in the pattern, the entire
pattern must be enclosed in quotes (“).To include quotation mark in the pattern ,two
quotes in a row (“ “) must be used.
Example:
find john myfile
    display lines in the file myfile which contain john


find “john smith” in myfile
   display lines in the file myfile which contain john smith


find “john”” smith” in myfile
  display lines in the file myfile which contain john” smith
Parameters (explicit input to the functional unit)
Example:       size
find john myfile
    display lines in the file myfile which contain john
           quote              emb blank
find “john smith” in myfile
   display lines in the file myfile which contain john smith

                              emb quotes
find “john”” smith” in myfile
  display lines in the file myfile which contain john” smith
Parameters:
Pattern size:
    empty
    single character
    many character
    longer than any line in the file
Quoting:
   pattern is quoted
   pattern is not quoted
   pattern is improperly quoted
Embedded blanks:
  no embedded blank
  one embedded blank
  several embedded blanks
Embedded quotes:
   no embedded quotes
   one embedded quotes
   several embedded quotes

 File name:
    good file name
    no file with this name


Environments (characteristics of the system’s state):
 Number of occurrence of pattern in file:
  none
  exactly one                                     Total Tests frames:
  more than one                                          1944
 Pattern occurrences on target line:
   one
   more than one
Pattern size : empty
Quoting : pattern is quoted
Embedded blanks : several embedded blanks
Embedded quotes : no embedded quote
File name : good file name
Number of occurrence of pattern in file : none
Pattern occurrence on target line : one

However, not all combinations of value classes
correspond to reasonable test case specifications!!!
• Properties
– [property A, B, …]
– A and B are property names
– E.g., [property Empty]


• Selector expression
– [if A]
– E.g., [if Empty]
Parameters:
 Pattern size:
     empty                             [ property Empty ]
     single character                  [ property NonEmpty ]
     many character                     [ property NonEmpty ]
    longer than any line in the file     [ property NonEmpty ]


 Quoting:
    pattern is quoted                  [ property quoted ]
    pattern is not quoted               [ if NonEmpty ]
    pattern is improperly quoted        [ if NonEmpty ]


 Embedded blanks:
   no embedded blank                   [ if NonEmpty ]
   one embedded blank                  [ if NonEmpty and Quoted ]
   several embedded blanks             [ if NonEmpty and Quoted ]
Embedded quotes:
    no embedded quotes           [ if NonEmpty ]
   one embedded quotes           [ if NonEmpty ]
   several embedded quotes       [ if NonEmpty ]
File name:
   good file name
   no file with this name
Environments:                                                   Total Tests frames:
 Number of occurrence of pattern in file:                               678

    none                        [ if NonEmpty ]
   exactly one                  [ if NonEmpty ] [ property Match]

   more than one                 [ if NonEmpty ] [ property Match ]
 Pattern occurrences on target line:
   one                          [ if Match ]
   more than one                  [ if Match ]
The label [error] indicates a value class that need be
tried only once, in combination with non-error values
of other parameters.
Parameters:
 Pattern size:
     empty                             [ property Empty ]
     single character                  [ property NonEmpty ]
     many character                     [ property NonEmpty ]
    longer than any line in the file     [ error ]


 Quoting:
    pattern is quoted                  [ property quoted ]
    pattern is not quoted               [ if NonEmpty ]
    pattern is improperly quoted        [ error ]


 Embedded blanks:
   no embedded blank                   [ if NonEmpty ]
   one embedded blank                  [ if NonEmpty and Quoted ]
   several embedded blanks             [ if NonEmpty and Quoted ]
Embedded quotes:
    no embedded quotes          [ if NonEmpty ]
   one embedded quotes           [ if NonEmpty ]
   several embedded quotes       [ if NonEmpty ]


                                                                        [ single ]
File name:
   good file name
   no file with this name       [ error ]



Environments:                                                               Total Tests frames:
                                                                            Total Tests frames:
 Number of occurrence of pattern in file:                                           40
                                                                                    125
    none                        [ if NonEmpty ]

   exactly one                  [ if NonEmpty ] [ property Match]

   more than one                 [ if NonEmpty ] [ property Match ]



 Pattern occurrences on target line:                                  [ single ]
   one                         [ if Match ]
   more than one                  [ if Match ]


                                                                          [ single ]
• Use a constraint solver
• Choose specific values that satisfy the
constraints
Black box testing (an introduction to)
A completely different approach:
 →We   cannot realistically presume to find and remove the last
 failure.
 →Then, we should invest test resources to find out the
 “biggest” ones.
“Goodness” here means to minimise the user
perceived faults, i.e.
 →Tryto find earlier those bugs that are more frequently
 encountered (neglect “small” bugs)
 →Not suitable for safety critical applications
Identify:
 •   Typical usage scenario
 •   Frequency of those scenarios


Test more, more frequent scenarios
Black box testing (an introduction to)

More Related Content

PPTX
PPT
White boxvsblackbox
PPT
Black box & white-box testing technique
PPT
Testing, black ,white and gray box testing
PPTX
Black box software testing
PPTX
10 software testing_technique
PPT
Black Box Testing
PPTX
WHITE BOX & BLACK BOX TESTING IN DATABASE
White boxvsblackbox
Black box & white-box testing technique
Testing, black ,white and gray box testing
Black box software testing
10 software testing_technique
Black Box Testing
WHITE BOX & BLACK BOX TESTING IN DATABASE

What's hot (20)

PPTX
Structural testing
PPT
White box testing-200709
PPT
White box testing
PPTX
Black Box Testing
PPTX
White Box Testing
PPT
New software testing-techniques
PPTX
White box & Black box testing
PPTX
An Insight into the Black Box and White Box Software Testing
PPTX
Se (techniques for black box testing ppt)
PPS
Boundary and equivalnce systematic test design
PPTX
Test Case Design
PPT
Whitebox testing
ODP
White box ppt
PPS
Lesson 2....PPT 1
PDF
Black Box Testing
PPTX
Introduction to White box testing
PPTX
Software Testing Foundations Part 4 - Black Box Testing
PPT
White Box Testing V0.2
PPT
Testing Fundamentals
PPT
Whitebox
Structural testing
White box testing-200709
White box testing
Black Box Testing
White Box Testing
New software testing-techniques
White box & Black box testing
An Insight into the Black Box and White Box Software Testing
Se (techniques for black box testing ppt)
Boundary and equivalnce systematic test design
Test Case Design
Whitebox testing
White box ppt
Lesson 2....PPT 1
Black Box Testing
Introduction to White box testing
Software Testing Foundations Part 4 - Black Box Testing
White Box Testing V0.2
Testing Fundamentals
Whitebox
Ad

Viewers also liked (20)

PPTX
Black box
PPTX
Software configuration items
PPTX
EquivalencePartition
PPTX
Boundary value analysis and equivalence partitioning
DOC
Project Report
PPT
Equivalence partitions analysis
PPTX
Software Configuration Management
PPTX
Software configuration management
DOC
The importance of quality software
PPTX
Structural and functional testing
PDF
Equivalence partitioning
PPTX
Equivalence partinioning and boundary value analysis
PPT
Code coverage
PDF
PDF
Techniques in black box testing
PPT
Software Configuration Management
PPTX
Aims, goals and objectives
PPT
Software Testing Techniques
PPTX
PPTX
Black box
Software configuration items
EquivalencePartition
Boundary value analysis and equivalence partitioning
Project Report
Equivalence partitions analysis
Software Configuration Management
Software configuration management
The importance of quality software
Structural and functional testing
Equivalence partitioning
Equivalence partinioning and boundary value analysis
Code coverage
Techniques in black box testing
Software Configuration Management
Aims, goals and objectives
Software Testing Techniques
Ad

Similar to Black box testing (an introduction to) (20)

PPT
Testing foundations
PPT
AutoTest.ppt
PPT
AutoTest.ppt
PPT
AutoTest.ppt
PPT
AutoTest for software engineering for automated testing
PPT
Automation testing basics and tools presentation
PPTX
SE%200-Testing%20(2).pptx
PPT
12 functional-system-testing
PPS
Testing techniques
PDF
Testing computer software
PPT
11 whiteboxtesting
PDF
Black Box Testing.pdf
PPT
Test Techniques
PPT
Testing Software Solutions
PDF
White Box Testing (Introduction to)
PPT
testing(2).pptjjsieieo2i33kejjskskosowwiwk
PPT
Testing
PPT
&lt;p>Software Testing&lt;/p>
PPT
An overview to Software Testing
PPTX
Structural Testing: When Quality Really Matters
Testing foundations
AutoTest.ppt
AutoTest.ppt
AutoTest.ppt
AutoTest for software engineering for automated testing
Automation testing basics and tools presentation
SE%200-Testing%20(2).pptx
12 functional-system-testing
Testing techniques
Testing computer software
11 whiteboxtesting
Black Box Testing.pdf
Test Techniques
Testing Software Solutions
White Box Testing (Introduction to)
testing(2).pptjjsieieo2i33kejjskskosowwiwk
Testing
&lt;p>Software Testing&lt;/p>
An overview to Software Testing
Structural Testing: When Quality Really Matters

More from Henry Muccini (20)

PPTX
Human Behaviour Centred Design
PDF
How cultural heritage, cyber-physical spaces, and software engineering can wo...
PDF
La gestione dell’utenza numerosa - dalle Segreterie, ai Musei, alle Segreterie
PDF
Turismo 4.0: l'ICT a supporto del turismo sostenibile
PDF
Sustainable Tourism - IoT and crowd management
PDF
Software Engineering at the age of the Internet of Things
PDF
The influence of Group Decision Making on Architecture Design Decisions
PDF
An IoT Software Architecture for an Evacuable Building Architecture
PDF
Web Engineering L8: User-centered Design (8/8)
PDF
Web Engineering L7: Sequence Diagrams and Design Decisions (7/8)
PDF
Web Engineering L6: Software Architecture for the Web (6/8)
PDF
Web Engineering L5: Content Model (5/8)
PDF
Web Engineering L3: Project Planning (3/8)
PDF
Web Engineering L2: Requirements Elicitation for the Web (2/8)
PDF
Web Engineering L1: introduction to Web Engineering (1/8)
PDF
Web Engineering L4: Requirements and Planning in concrete (4/8)
PDF
Collaborative aspects of Decision Making and its impact on Sustainability
PDF
Engineering Cyber Physical Spaces
PDF
I progetti UnivAq-UFFIZI, INCIPICT, e  CUSPIS
PDF
Exploring the Temporal Aspects of Software Architecture
Human Behaviour Centred Design
How cultural heritage, cyber-physical spaces, and software engineering can wo...
La gestione dell’utenza numerosa - dalle Segreterie, ai Musei, alle Segreterie
Turismo 4.0: l'ICT a supporto del turismo sostenibile
Sustainable Tourism - IoT and crowd management
Software Engineering at the age of the Internet of Things
The influence of Group Decision Making on Architecture Design Decisions
An IoT Software Architecture for an Evacuable Building Architecture
Web Engineering L8: User-centered Design (8/8)
Web Engineering L7: Sequence Diagrams and Design Decisions (7/8)
Web Engineering L6: Software Architecture for the Web (6/8)
Web Engineering L5: Content Model (5/8)
Web Engineering L3: Project Planning (3/8)
Web Engineering L2: Requirements Elicitation for the Web (2/8)
Web Engineering L1: introduction to Web Engineering (1/8)
Web Engineering L4: Requirements and Planning in concrete (4/8)
Collaborative aspects of Decision Making and its impact on Sustainability
Engineering Cyber Physical Spaces
I progetti UnivAq-UFFIZI, INCIPICT, e  CUSPIS
Exploring the Temporal Aspects of Software Architecture

Recently uploaded (20)

PPTX
Institutional Correction lecture only . . .
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Sports Quiz easy sports quiz sports quiz
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
GDM (1) (1).pptx small presentation for students
PDF
01-Introduction-to-Information-Management.pdf
Institutional Correction lecture only . . .
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Anesthesia in Laparoscopic Surgery in India
2.FourierTransform-ShortQuestionswithAnswers.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
O7-L3 Supply Chain Operations - ICLT Program
Microbial disease of the cardiovascular and lymphatic systems
PPH.pptx obstetrics and gynecology in nursing
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
STATICS OF THE RIGID BODIES Hibbelers.pdf
Cell Types and Its function , kingdom of life
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Sports Quiz easy sports quiz sports quiz
Module 4: Burden of Disease Tutorial Slides S2 2025
GDM (1) (1).pptx small presentation for students
01-Introduction-to-Information-Management.pdf

Black box testing (an introduction to)

  • 1. Università degli Studi dell’Aquila L21: Black Box/Functional Testing Henry Muccini DISIM, University of L’Aquila www.henrymuccini.com, henry.muccini@univaq.it
  • 2. The material in these slides may be freely reproduced and distributed, partially or totally, as far as an explicit reference or acknowledge to the material author is preserved. Partially based on material from Alex Orso, Mauro Pezze’, and Michal Young.
  • 3. AGENDA White box testing Representative values Systematic vs Random Testing Equivalence Partitioning Category Partition Method
  • 4. Where is the boundary between testing and other (analysis/verification) methods? What distinguishes software testing from “other” approaches is execution. This requires the ability to: → launch the tests on some executable version (traceability problem), and → analyse (observe and evaluate) the results (not granted for embedded systems) I am not saying testing is superior and we should disregard other approaches: on the contrary, testing and other methods should complement/support each other
  • 5. Any software test campaign involves a trade-off between → Limiting resource utilization (time, effort) ⇒ as few tests as possible → Augmenting our confidence ⇒ as many tests as possible Two research challenges: → Determining a feasible and meaningful stopping rule → Evaluating test effectiveness (reliability, “coverage notion”, ....very tough problem
  • 7. Functional testing: Deriving test cases from program specifications ─ Functional refers to the source of information used in test case design, not to what is tested Also known as: → specification-based testing (from specifications) → black-box testing (no view of the code) Functional specification = description of intended program behavior → either formal or informal (C) 2007 MAURO PEZZÈ & MICHAL YOUNG
  • 8. Exploit some knowledge to choose samples that are more likely to include “special” or trouble-prone regions of the input space → Failures are sparse in the whole input space ... → ... but we may find regions in which they are dense Desirable case: Each fault leads to failures that are dense (easy to find) in some class of inputs → sampling each class in the quasi-partition selects at least one input that leads to a failure, revealing the fault → seldom guaranteed; we depend on experience-based heuristics (C) 2007 MAURO PEZZÈ & MICHAL YOUNG
  • 9. Failures are sparse Failure (valuable test case) ... but dense in some in the space of parts of the space No failure possible inputs ... The space of possible input values (the haystack) If we systematically test some Functional testing is one way of cases from each part, we will drawing pink lines to isolate include the dense parts regions with likely failures (C) 2007 MAURO PEZZÈ & MICHAL YOUNG
  • 10. Random (uniform): → Pickpossible inputs uniformly → Avoids designer bias ─ A real problem: The test designer can make the same logical mistakes and bad assumptions as the program designer (especially if they are the same person) → But treats all inputs as equally valuable (C) 2007 MAURO PEZZÈ & MICHAL YOUNG
  • 12. Defects are not distributed uniformly! •  Assume our printSum program fails if both inputs are 0! •  Random sampling is unlikely to choose a = 0 and b = 0! We want bias!!
  • 13. Systematic (non-uniform): → Try to select inputs that are especially valuable → Usually by choosing representatives of classes that are apt to fail often or not at all Functional testing is systematic testing
  • 15. •An independently testable feature (ITF) is a functionality that can be tested independently of other functionalities of the software under test. •It need not correspond to a unit or subsystem of the software. •For example, a file sorting utility may be capable of merging two sorted files, and it may be possible to test the sorting and merging functionalities separately, even though both features are implemented by much of the same source code.
  • 16. It is recommended to devise separate test cases for each functionality of the system, whenever possible. The design of different tests for different functionalities can simplify the test generation problem Thus, identifying functional features does not correspond to identifying single modules at the design level, but rather to suitably slicing the specifications to be able to attack their complexity incrementally Feature-based view of the system
  • 18. Functional testing uses the specification (formal or informal) to partition the input space → E.g., specification of “roots” program suggests division between cases with zero, one, and two real roots Test each category, and boundaries between categories → No guarantees, but experience suggests failures often lie at the boundaries (as in the “roots” program) (C) 2007 MAURO PEZZÈ & MICHAL YOUNG
  • 19. •Try to select inputs that are especially valuable! • Usually by choosing representatives of equivalence classes! •Assumption: inputs in different categories behave equivalently ⇒I can select one input per category
  • 20. Consider a software module that is intended to accept the name of a grocery item and a list of the different sizes the item comes in, specified in ounces. The specifications state that the item name is to be alphabetic characters 2 to 15 characters in length. Each size may be a value in the range of 1 to 48, whole numbers only. The sizes are to be entered in ascending order (smaller sizes first). A maximum of five sizes may be entered for each item. The item name is to be entered first, followed by a comma, then followed by a list of sizes. A comma will be used to separate each size. Spaces (blanks) are to be ignored anywhere in the input. Taken from: http://users.csc.calpoly.edu/~jdalbey/205/Resources/grocerystore.
  • 21. Consider a software module that is intended to accept the name of a grocery item and a list of the different sizes the item comes in, specified in ounces. The specifications state that the item name is to be alphabetic characters 2 to 15 characters in length. Each size may be a value in the range of 1 to 48, whole numbers only. The sizes are to be entered in ascending order (smaller sizes first). A maximum of five sizes may be entered for each item. The item name is to be entered first, followed by a comma, then followed by a list of sizes. A comma will be used to separate each size. Spaces (blanks) are to be ignored anywhere in the input.
  • 22. Item name is alphabetic (valid) Item name is not alphabetic (invalid) Item name is less than 2 characters in length (invalid) Item name is 2 to 15 characters in length (valid) Item name is greater than 15 characters in length (invalid) Size value is less than 1 (invalid) Size value is in the range 1 to 48 (valid) Size value is greater than 48 (invalid) Size value is a whole number (valid) Size value is a decimal (invalid) Size value is numeric (valid) Size value includes nonnumeric characters (invalid) Size values entered in ascending order (valid) Size values entered in nonascending order (invalid) No size values entered (invalid) One to five size values entered (valid) More than five sizes entered (invalid) Item name is first (valid) …
  • 23. Expected # Test Data Classes Covered Outcome 1 xy,1 T 1,4,7,9,11,13,16,18,20,22 2 AbcDefghijklmno,1,2,3 ,4,48 T 1,4,7,9,11,13,16,18,20,23 3 a2x,1 F 2 4 A,1 F 3 5 abcdefghijklmnop F 5 6 Xy,0 F 6 7 XY,49 F 8 8 Xy,2.5 F 10 9 xy,2,1,3,4,5 F 14 10 Xy F 15 11 XY,1,2,3,4,5,6 F 17 12 1,Xy,2,3,4,5 F 19 13 XY2,3,4,5,6 F 21 14 AB,2#7 F 12
  • 25. Item name is alphabetic (valid) Item name is not alphabetic (invalid) Item name is less than 2 characters in length (invalid) Item name is 2 to 15 characters in length (valid) Item name is greater than 15 characters in length (invalid) Size value is less than 1 (invalid) Size value is in the range 1 to 48 (valid) Size value is greater than 48 (invalid) Size value is a whole number (valid) Size value is a decimal (invalid) Size value is numeric (valid) Size value includes nonnumeric characters (invalid) Size values entered in ascending order (valid) Size values entered in nonascending order (invalid) No size values entered (invalid) One to five size values entered (valid) More than five sizes entered (invalid) Item name is first (valid) …
  • 26. The main idea is to partition the input domain of function being tested, and then select test data for each class of the partition. The problem of all the existing techniques is the lack of systematic. Solution: the Category Partition Method
  • 27. Steps: ITF (Independently testable feature) Identify parameters and Environmental conditions Parameters: Explicit input to the functional unit Environmental Conditions: Characteristics of the system’s state Find categories that characterize each parameter and environment condition. Every category should be partitioned into distinct choices Test Spec
  • 28. Command: find (a pattern into a file) Syntax: find <pattern> <file> Function: The find command is used to locate one or more instance of a given pattern in a text file. All lines in the file that contain the pattern are written to standard output. A line containing the pattern is written only once, regardless of the number of times the pattern occurs in it. The pattern is any sequence of characters whose length does not exceed the maximum length of a line in the file .To include a blank in the pattern, the entire pattern must be enclosed in quotes (“).To include quotation mark in the pattern ,two quotes in a row (“ “) must be used.
  • 29. Example: find john myfile display lines in the file myfile which contain john find “john smith” in myfile display lines in the file myfile which contain john smith find “john”” smith” in myfile display lines in the file myfile which contain john” smith
  • 30. Parameters (explicit input to the functional unit) Example: size find john myfile display lines in the file myfile which contain john quote emb blank find “john smith” in myfile display lines in the file myfile which contain john smith emb quotes find “john”” smith” in myfile display lines in the file myfile which contain john” smith
  • 31. Parameters: Pattern size: empty single character many character longer than any line in the file Quoting: pattern is quoted pattern is not quoted pattern is improperly quoted Embedded blanks: no embedded blank one embedded blank several embedded blanks
  • 32. Embedded quotes: no embedded quotes one embedded quotes several embedded quotes File name: good file name no file with this name Environments (characteristics of the system’s state): Number of occurrence of pattern in file: none exactly one Total Tests frames: more than one 1944 Pattern occurrences on target line: one more than one
  • 33. Pattern size : empty Quoting : pattern is quoted Embedded blanks : several embedded blanks Embedded quotes : no embedded quote File name : good file name Number of occurrence of pattern in file : none Pattern occurrence on target line : one However, not all combinations of value classes correspond to reasonable test case specifications!!!
  • 34. • Properties – [property A, B, …] – A and B are property names – E.g., [property Empty] • Selector expression – [if A] – E.g., [if Empty]
  • 35. Parameters: Pattern size: empty [ property Empty ] single character [ property NonEmpty ] many character [ property NonEmpty ] longer than any line in the file [ property NonEmpty ] Quoting: pattern is quoted [ property quoted ] pattern is not quoted [ if NonEmpty ] pattern is improperly quoted [ if NonEmpty ] Embedded blanks: no embedded blank [ if NonEmpty ] one embedded blank [ if NonEmpty and Quoted ] several embedded blanks [ if NonEmpty and Quoted ]
  • 36. Embedded quotes: no embedded quotes [ if NonEmpty ] one embedded quotes [ if NonEmpty ] several embedded quotes [ if NonEmpty ] File name: good file name no file with this name Environments: Total Tests frames: Number of occurrence of pattern in file: 678 none [ if NonEmpty ] exactly one [ if NonEmpty ] [ property Match] more than one [ if NonEmpty ] [ property Match ] Pattern occurrences on target line: one [ if Match ] more than one [ if Match ]
  • 37. The label [error] indicates a value class that need be tried only once, in combination with non-error values of other parameters.
  • 38. Parameters: Pattern size: empty [ property Empty ] single character [ property NonEmpty ] many character [ property NonEmpty ] longer than any line in the file [ error ] Quoting: pattern is quoted [ property quoted ] pattern is not quoted [ if NonEmpty ] pattern is improperly quoted [ error ] Embedded blanks: no embedded blank [ if NonEmpty ] one embedded blank [ if NonEmpty and Quoted ] several embedded blanks [ if NonEmpty and Quoted ]
  • 39. Embedded quotes: no embedded quotes [ if NonEmpty ] one embedded quotes [ if NonEmpty ] several embedded quotes [ if NonEmpty ] [ single ] File name: good file name no file with this name [ error ] Environments: Total Tests frames: Total Tests frames: Number of occurrence of pattern in file: 40 125 none [ if NonEmpty ] exactly one [ if NonEmpty ] [ property Match] more than one [ if NonEmpty ] [ property Match ] Pattern occurrences on target line: [ single ] one [ if Match ] more than one [ if Match ] [ single ]
  • 40. • Use a constraint solver • Choose specific values that satisfy the constraints
  • 42. A completely different approach: →We cannot realistically presume to find and remove the last failure. →Then, we should invest test resources to find out the “biggest” ones. “Goodness” here means to minimise the user perceived faults, i.e. →Tryto find earlier those bugs that are more frequently encountered (neglect “small” bugs) →Not suitable for safety critical applications
  • 43. Identify: • Typical usage scenario • Frequency of those scenarios Test more, more frequent scenarios