SlideShare une entreprise Scribd logo
1  sur  163
SOFTWARE QUALITY AND
TESTING
What is quality ?
Quality popular view:
  – Something “good” but not quantifiable
  – Something luxurious and classy


Quality professional view:
  – Conformance to requirement
  (Crosby, 1979)
       The requirements are clearly stated and the product must conform to it
       Any deviation from the requirements is regarded as a defect
         A good quality product contains fewer defects


  – Fitness for use (Juran, 1970):
       Fit to user expectations: meet user’s needs
       A good quality product provides better user satisfaction

                                                                                 2
DEFINITION OF QUALITY
Definition of Quality

  ISO 8402 definition
                                  ISO 9216 Model:
  of QUALITY:
                                  Quality characteristics
  The totality of features and
  characteristics of a product    1.Functionality
  or a service that bear on
                                  2.Reliability
                                  3.Usability
  its ability to satisfy stated
                                  4.Efficiency
  or implied needs                5.Maintainability
                                  6.Portability
                                                            4
QUALITY ASPECTS
Quality Concepts
 •   Quality of design
      – refers to characteristics designers specify for the end product to
        be constructed
 •   Quality of conformance
      – degree to which design specifications are followed in
        manufacturing the product
 •   Quality control
      – series of inspections, reviews, and tests used to ensure
        conformance of a work product (artifact) to its specifications
 •   Quality assurance
      – auditing and reporting procedures used to provide management
        with data needed to make proactive decisions



                                                                             6
Quality Control versus
Quality Assurance
Quality Control versus Quality
Assurance

• Quality Control (QC) is a set of activities carried out with the
  main objective of withholding products from shipment if they
  do not qualify.

• Quality Assurance (QA) is meant to minimize the costs of
  quality by introducing a variety of activities throughout the
  development process and maintenance process in order to
  prevent the causes of errors, detect them, and correct them
  in the early stages of the development. As a result, quality
  assurance substantially reduces the rate of non-qualifying
  products.

                                                                  8
Quality as Dealing with defects


•   When people associate Quality or High Quality with software system, it is
    an indication that few, if any, defects are expected to occur during its
    operations or when problems do occur, the negative impact is expected
    to be minimized.

•   Key of the correctness aspect of software quality is the concept of defect,
    failure, fault and error.

•   The term “defect” refers to some problem with the software either with its
    external or with internal characteristics.



                                                                                 9
Causes of software
defects
Causes of software defects

1. Faulty requirements definition
2. Client-developer communication failures
3. Deliberate deviations from software requirements
4. Logical design errors
5. Coding errors
6. Non-compliance with documentation and coding
   instructions
7. Shortcomings of the testing process
8. User interface and procedure errors
9. Documentation errors
                                                      11
Software errors, software faults
and software failures

     Software development process

                                    software error
                                    software fault
                                    software failure




                                                     12
Software errors, software faults
and software failures

 More precisely:

 •   An error can be a grammatical error in one or more of the code
     lines, or a logical error in carrying out one or more of the client’s
     requirements.

 •   Not all software errors become software faults. in some cases, the
     software error can cause improper functioning of the software. In
     many other cases, erroneous code lines will not affect the
     functionality of the software as a whole.

 •   A failure is said to occur whenever the external behavior of a system
     does not conform to that prescribed in the system specification. A
     software fault becomes a software failure only when it is “activated”
                                                                             13
Error,
faults,
failures




           14
Tools for Improving Quality

•   Formal specification
•   Self-checking code
•   Program verification and validation
•   Testing
•   Deploy with capabilities to repair
Software Testing


• Software testing is a popular risk management
  strategy. It is used to verify that functional
  requirements were met.


• The limitation of this approach, however, is that by
  the time testing occurs, it is too late to build quality
  into the product

                                                        16
What is Software
   Testing?
“Testing is the process of establishing confidence that a
program or system does what it is supposed to.”
by Hetzel 1973

“Testing is the process of executing a program or system
with the intent of finding errors.” by Myers 1979

“Testing is any activity aimed at evaluating an attribute
or capability of a program or system and determining
that it meets its required results.” by Hetzel 1983
Testing is NOT

•   Code inspections
•   Design reviews
•   Configuration management
•   Bug tracking

These are, along with testing, are part of Software
     Quality Assurance (SQA). Together these
         improve the quality of the product
TYPES OF TESTING
Types of Testing:

 Scope              Execution
   Unit               Manual
   Module             Automated
   Integration
   Interface        Phases/Triggers
   Coverage           Nightly Builds
                       Defect Removal
 Purpose              Change Order Completion
   Functional         Alpha
   Stress             Beta
WHO ARE THE TESTERS?
Who Tests?

 Developers
   Unit testing
 QA Team
   Module testing, automated testing
 Software
   Automated testing
 Designers
   Engineers, Analysts
 Users
   Unpleasant but true
Testing, debugging, Verification
TESTING AND DEBUGGING
Testing and debugging




 Testing is the process of determining if a
 program has any
 errors.

 When testing reveals an error, the process used
 to determine the cause of this error and to
 remove it, is known as debugging.
A test/debug cycle
WHAT I TEST PLAN
Test plan


A test cycle is often guided by a test plan.

Example: The sort program is to be tested to meet the
requirements given earlier. Specifically, the following needs to
be done.

   •   Execute sort on at least two input sequences, one
       with ``A'' and the other with ``D'' as request
       characters.
Test plan (contd.)




    •   Execute the program on an empty input
        sequence.

    •   Test the program for robustness against
        erroneous inputs such as ``R'' typed in as the request
        character.

    •   All failures of the test program should be recorded in a
        suitable file using the Company Failure Report Form.
Test case/data



    A test case is a pair consisting of test data to       be
        input to the program and the expected output. The test
        data is a set of values, one for each input variable.

    A test set is a collection of zero or more test cases.

                       Sample test case for sort:

                       Test data: <''A'’ 12 -29 32 >
                       Expected output: -29 12 32
TESTING AND VERIFICATION
Testing and verification


Program verification aims at proving the correctness of
programs by showing that it contains no errors. This is very
different from testing that aims at uncovering errors in a
program.


Program verification and testing are best considered as
complementary techniques. In practice, one can discard program
verification, but not testing.
Testing and verification (contd.)


Testing is not a perfect technique in that a program might
contain errors despite the success of a set of tests.

Verification might appear to be perfect technique as it promises
to verify that a program is free from errors. However, the person
who verified a program might have made mistake in the
verification process; there might be an incorrect assumption on
the input conditions; incorrect assumptions might be made
regarding the components that interface with the program, and
so on.
Software quality assurance and
          testing in
   Structured programming
Structure Programming and
Unstructured Programming
Structured Programming

• structured programming: A technique for
  organizing and coding computer programs in
  which a hierarchy of modules is used.
• Each having a single entry and a single exit point,
  and in which control is passed downward through
  the structure.
STRUCTURED PROGRAMMING

• In structured Programming each construct has a
  predictable logical structure.
• This could enabling a reader to follow procedural
  flow more easily.
• The constructs are sequence, condition, and
  repetition.
STRUCTURED PROGRAMMING

• Sequence implements processing steps that are
  essential in the specification of any algorithm.
• Condition provides the facility for selected
  processing based on some logical occurrence.
• Repetition allows for looping.
• These three constructs are fundamental to
  structured        programming—an           important
  component-level design technique.
STRUCTURED PROGRAMMING

• The structured constructs were proposed to limit
  the procedural design of software to a small
  number of predictable operations.
• Complexity metrics indicate that the use of the
  structured constructs reduces program complexity
  and thereby enhances readability, testability, and
  maintainability.
STRUCTURED PROGRAMMING

• The use of a limited number of logical constructs
  also contributes to a human understanding
  process that is known as chunking.
• To understand this process, consider the way in
  which you are reading this page.
• You do not read individual letters but rather
  recognize patterns or chunks of letters that form
  words or phrases.
STRUCTURED PROGRAMMING

• The structured constructs are logical chunks that
  allow a reader to recognize procedural elements
  of a module, rather than reading the design or
  code line by line.
• Understanding is enhanced when readily
  recognizable logical patterns are encountered.
STRUCTURED PROGRAMMING

• Any program, regardless of application area or
  technical complexity, can be designed and
  implemented using only the three structured
  constructs.
• It should be noted, however, that strict use of only
  these constructs can sometimes cause practical
  difficulties.
Unstructured programming

All the program code written in a single continuous
main program.

                   Many disadvantages for large programs
                   • difficult to follow logic
                   • if something needs to be done more than
                     once must be re-typed
                   • hard to incorporate other code
                   • not easily modified
                   • difficult to test particular portions of the code
                   • ...
Advantages of Structured
Programming
Advantages of Structured
Programming
•   Easy to write:
    Modular design increases the programmer's productivity by
    allowing them to look at the big picture first and focus on details
    later.

    Several Programmers can work on a single, large program,
    each working on a different module

    Studies show structured programs take less time to write than
    standard programs.

    Procedures written for one program can be reused in other
    programs requiring the same task. A procedure that can be
    used in many programs is said to be reusable
Advantages of Structured
Programming
•   Easy to debug
    Since each procedure is specialized to perform just one task, a
    procedure can be checked individually. Older unstructured programs
    consist of a sequence of instructions that are not grouped for specific
    tasks. The logic of such programs is cluttered with details and therefore
    difficult to follow.

    Easy to Understand
    The relationship between the procedures shows the modular design of
    the program.


    Easy to Change
    Since a correctly written structured program is self-documenting, it can
    be easily understood by another programmer.
Structured programming using
graphical design notation
Graphical Design Notation


• "A picture is worth a thousand words," but it's
  rather important to know which picture and which
  1000 words.
• There is no question that graphical tools, such as
  the flowchart or box diagram, provide useful
  pictorial patterns that readily depict procedural
  detail.
• However, if graphical tools are misused, the
  wrong picture may lead to the wrong software.
Graphical Design Notation

• A flow chart is quite simple pictorially.
• A box is used to indicate a processing step.
• A diamond represents a logical condition, and
  arrows show the flow of control.
Graphical Design Notation

• The sequence is represented as two processing
  boxes connected by an line (arrow) of control.
Graphical Design Notation

• Condition, also called if-then-else, is shown as a
  decision diamond that if true, causes then-part
  processing to occur, and if false, invokes else-part
  processing.
Graphical Design Notation

• The selection (or
  select-case) construct
  shown in the figure is
  actually an extension
  of theif-then-else. A
  parameter is tested
  by         successive
  decisions until a true
  condition occurs and
  a       case      part
  processing path is
Graphical Design Notation

• Repetition is represented using two slightly different forms.
  The do while tests a condition and executes a loop task
  repetitively as long as the condition holds true.
• A repeat until executes the loop task first, then tests a
  condition and repeats the task until the condition fails.
Graphical Design Notation
• The structured constructs may be nested within
  one another as shown in Figure
Structured programming
using Box diagram
The box diagram
The box diagram
The box diagram
The box diagram
Structure Programming and
testing
Structure Programming and
testing

(1) guarantee that all independent paths within a
  module have been exercised at least once,
(2) exercise all logical decisions on their true and
  false sides,
(3) execute all loops at their boundaries and within
  their operational bounds, and
(4) exercise internal data structures to ensure their
  validity.
BASIS PATH TESTING
Structure Programming and
testing

• BASIS PATH TESTING : Test cases derived to
  check the execution of every statement in the
  program at least one time during testing.
  –   Flow Graph Notation
  –   Cyclomatic Complexity
  –   Deriving Test Cases
  –   Graph Matrices
What is Flow Graph Notation
Flow Graph Notation

• Draw a flow graph when the logical control structure of a
  module is complex. The flow graph enables you to trace
  program paths more readily.
Types of Logic Coverage

• Statement: each statement executed at
  least once
• Branch: each branch traversed (and every
  entry point taken) at least once
• Condition: each condition True at least
  once and False at least once
• Branch/Condition:         both Branch and
  Condition coverage achieved
Types of Logic Coverage (cont’d)


• Compound Condition: all combinations of
  condition values at every branch statement
  covered (and every entry point taken)
• Path: all program paths traversed at least
  once
Control Flow Graphs

                      “nodes”




                       “edges”
Statement Coverage

• Statement Coverage requires that each
  statement will have been executed at
  least once.
• Simplest form of logic coverage.
• Also known as Node Coverage.
Statement Coverage
  • Statement should be executed completely or
    not at all.

  • For example:
             IF a THEN b ENDIF

   is considered as more than 1 statement since b
     may or may not be executed depending on the
                     condition a.
Branch Coverage

• Branch Coverage requires that each
  branch will have been traversed, and
  that every program entry point will
  have been taken, at least once.
• Also known as Edge Coverage.
Branch Coverage
• Attempting to cover all the paths in the software is
  called path coverage
• The simplest form of path testing is called branch
  testing
________________________________
Print “Hello World”
IF Date == “01-01-2005” THEN
   Print “Happy New Year”
ELSE
   Print “Have a good day!”
END IF
Print “The date is: ”+Date
Print “The time is: ”+Time
END
________________________________
• To test each branch you would need to execute 2 test
  cases, one with the date set to 1st Jan 2005, and
  another with any other date.
Condition Coverage

 • A branch predicate may have
   more than one condition.
     input(X,Y)
     if (Y<=0) or (X=0) then
             Y := -Y
     end_if
     while (Y>0) and (not EOF) do
             input(X)
             Y := Y-1
     end_while
Condition Coverage
(cont’d)

• Condition Coverage requires that each
  condition will have been True at least
  once and False at least once.
Condition Coverage


________________________________
Print “Hello World”
IF Date == “01-01-2005” AND Time ==“00:00:00” THEN
   Print “Happy New Year”
ELSE
   Print “Have a good day!”
END IF
Print “The date is: ”+Date
Print “The time is: ”+Time
END
________________________________
• Condition Coverage takes extra conditions into
  consideration
• To achieve full condition coverage you would need
  4 test cases
Branch/Condition Coverage

• Branch/Condition Coverage requires
  that both Branch AND Condition
  Coverage will have been achieved.
• Therefore,   Branch/Condition Coverage
  subsumes both Branch Coverage and
  Condition Coverage.
Compound Condition
Coverage (cont’d)

• Compound Condition Coverage requires
  that all combinations of condition
  values at every branch statement will
  have been covered, and that every
  entry point will have been taken, at
  least once.
• Also   know     as   Multiple    Condition
  Coverage.
• Subsumes     Branch/Condition    Coverage,
  regardless of the order in which conditions
  are evaluated.
Path Coverage

 • Path Coverage requires that all
   program paths will have been
   traversed at least once.
 • Often described as the “strongest” form
   of logic coverage?
 • Path Coverage is usually impossible
   when loops are present. (How many test
   cases would be required to cover all
   paths in the example below?)
Loop Coverage

• Loop Coverage requires that the body
  of loops be executed 0, 1, 2, t, max,
  and max+1 times, where possible.
Loop Coverage (cont’d)

• Rationale: (cont’d)
  – Check loop re-initialization.
  – Check typical number of iterations.
  – Check upper (valid) bound on number of times
    body may be executed.
  – If the maximum can be exceeded, what behavior
    results?
Flow Graph Notation

• Each circle, called a flow graph node, represents
  one or more procedural statements.
• A sequence of process boxes and a decision
  diamond can map into a single node.
• The arrows on the flow graph, called edges or
  links, represent flow of control and are analogous
  to flowchart arrows.
Flow Graph Notation

• An edge must terminate at a node, even if the
  node does not represent any procedural
  statements (e.g., see the symbol for the if-then-
  else construct).
• Areas bounded by edges and nodes are called
  regions.
• When counting regions, we include the area
  outside the graph as a region.
Flow Graph Notation

• When compound conditions are encountered in a
  procedural design, the generation of a flow graph
  becomes slightly more complicated.
• A compound condition occurs when one or more
  Boolean operators (logical OR, AND, NAND,
  NOR) is present in a conditional statement.
Flow Graph Notation
• Note that a separate node is created for each of the
  conditions a and b in the statement IF a OR b.
• Each node that contains a condition is called a
  predicate node and is characterized by two or more
  edges emanating from it.
How to draw Control flow
graph?
• Sequence:
  – 1 a=5;       1
  – 2 b=a*b-1;
                 2




                           85
How to draw Control flow
graph?
• Selection:
  –   1 if(a>b) then
                           1
  –   2       c=3;
  –   3 else c=5;      2       3
  –   4 c=c*c;             4




                                   86
How to draw Control flow
graph?
• Iteration:           1
   –   1 while(a>b){
   –   2     b=b*a;
                       2
   –   3     b=b-1;}
   –   4 c=b+d;
                       3
                       4



                           87
Example
•   int f1(int x,int y){       1
•   1 while (x != y){
                               2
•   2 if (x>y) then
•   3        x=x-y;        3       4
•   4 else y=y-x;              5
•   5}
•                              6
    6 return x;        }


                                       88
How to draw Control flow
graph?
• Iteration:           1
   –   1 while(a>b){
   –   2     b=b*a;
                       2
   –   3     b=b-1;}
   –   4 c=b+d;
                       3
                       4



                           89
Cyclomatic Complexity

• Cyclomatic complexity is a software metric that
  provides a quantitative measure of the logical
  complexity of a program.
• It defines the number of independent paths in the
  basis set of a program and provides us with an
  upper bound for the number of tests that must be
  conducted to ensure that all statements have
  been executed at least once.
Cyclomatic Complexity
Complexity is computed in one
of three ways

• The number of regions of the flow graph
  correspond to the cyclomatic complexity.
• Cyclomatic complexity, V(G), for a flow graph, G,
  is defined as




• where E is the number of flow graph edges, N is
  the number of flow graph nodes.
Complexity is computed in one
of three ways

• Cyclomatic complexity, V(G), for a flow graph, G,
  is also defined as




• where P is the number of predicate nodes
  contained in the flow graph G.
Complexity is computed in one
of three ways
How to decide no. of test cases

• More important, the value for V(G) provides      us
  with an upper bound for the number               of
  independent paths that form the basis set and,   by
  implication, an upper bound on the number        of
  tests that must be designed and executed         to
  guarantee coverage of all program statements.
How to derive test cases

• Using the design or code as a foundation, draw a
  corresponding flow graph.
• Determine the cyclomatic complexity of the
  resultant flow graph.
• Determine a basis set of linearly independent
  paths.
• Prepare test cases that will force execution of
  each path in the basis set.
Example Control Flow
Graph
              1
              2
          3       4
              5
              6


  Cyclomatic complexity = E-N+2
            7-6+2 = 3.            97
Cyclomatic complexity

• Another way of computing cyclomatic
  complexity:
  – inspect control flow graph
  – determine number of bounded areas in the
    graph
• V(G) = Total number of bounded areas + 1


                                             98
Example Control Flow
Graph
              1


              2


          3       4

              5


              6



  From a visual examination of the CFG:
    the number of bounded areas is 2.
                                          99
    cyclomatic complexity = 2+1=3.
Example
•   int f1(int x,int y){
•   1 while (x != y){                         1

•   2 if (x>y) then                           2
•   3        x=x-y;
•   4 else y=y-x;                        3          4

•   5}                                        5

•   6 return x;        }                      6
             • Number of independent paths: 3
                – 1,6 test case (x=1, y=1)
                – 1,2,3,5,1,6 test case(x=1, y=2)
                                                        100
                – 1,2,4,5,1,6 test case(x=2, y=1)
2

1. void   myflow(int x, int y)
   {
                                                  3
2.         int a;                y == 0                        y != 0

3.        if (y == 0) {
4.            a = 1;                      4                     6

5.        } else {
6.            a = y;
                                                      7
           }
7.        y = y – 1;
8.        if (a > 0) {             a>0                8          a≤0
9.            a = x;
10.        } else {
                                              9                     11
11.            a = x + 1;
           }
12.        printf(“%dn”, a);                             12
      }
                                                                         101
White-box Test Methods

•   Statement Coverage
•   Decision/Branch Coverage
•   Condition Coverage
•   Decision/Condition Coverage
•   Path Coverage
Example Code Fragment

• If ((A>1) & (B=0)) then
  Do;
•      X=X/A;
•      END;
• If ((A==2) | (X>1)) then
  Do;
•      X=X+1;
•      END;
• END;
Statement Coverage

• Exercise all
  statements at least
  once
• How many test
  cases?
   A=2 and B=0 (ace)
Decision/Branch Coverage

• Each decision has a
  true and a false
  outcome at least once
• How many test
  cases?
   A=2 and B=0 (ace)
   A=1 and X=1 (abd)
Condition Coverage
• Each condition in a
  decision takes on all
  possible outcomes at
  least once
• Conditions: A>1, B=0,
  A=2, X>1
• How many test cases?
   A=2, B=0, and X=4 (ace)
   A=1, B=1, and X=1 (abd)
Decision/Condition Coverage
• Each condition in a decision
  takes on all possible
  outcomes at least once, and
  each decision takes on all
  possible outcomes at least
  once
• How many test cases?
    A=2, B=0, and X=4 (ace)
    A=1, B=1, and X=1 (abd)
• What about these?
    A=1, B=0, and X=3    (abe)
    A=2, B=1, and X=1    (abe)
Multiple Condition Coverage

• Exercise all possible
  combinations of
  condition outcomes in
  each decision
• Conditions:
  A>1, B=0     A=2, X>1
  A>1, B<>0    A=2, X<=1
  A<=1, B=0    A<>2, X>1
  A<=1, B<>0   A<>2, X<=1
Multiple Condition Coverage

• How many test
  cases?
   A=2, B=0, X=4   (ace)
   A=2, B=1, X=1   (abe)
   A=1, B=0, X=2   (abe)
   A=1, B=1, X=1   (abd)
Path Coverage

• Every unique path
  through the program
  is executed at least
  once
• How many test
  cases?
   A=2, B=0, X=4 (ace)
   A=2, B=1, X=1 (abe)
   A=3, B=0, X=1 (acd)
   A=1, B=1, X=1 (abd)
Graph Matrices

• A graph matrix is a square matrix whose size (i.e.,
  number of rows and columns) is equal to the
  number of nodes on the flow graph.
• Each row and column corresponds to an identified
  node, and matrix entries correspond to
  connections (an edge) between nodes.
Graph Matrices
Graph Matrices

• However, by adding a link weight to each matrix
  entry, the graph matrix can become a powerful
  tool for evaluating program control structure
  during testing.
• The link weight provides additional information
  about control flow.
• In its simplest form, the link weight is 1 (a
  connection exists) or 0 (a connection does not
  exist).
Graph Matrices
STRUCTURED
PROGRAMMING
Graph Matrices for testing

• A graph matrix is a square matrix whose size (i.e.,
  number of rows and columns) is equal to the
  number of nodes on the flow graph.
• Each row and column corresponds to an identified
  node, and matrix entries correspond to
  connections (an edge) between nodes.
Graph Matrices for testing
Graph Matrices for testing

• However, by adding a link weight to each matrix
  entry, the graph matrix can become a powerful
  tool for evaluating program control structure
  during testing.
• The link weight provides additional information
  about control flow.
• In its simplest form, the link weight is 1 (a
  connection exists) or 0 (a connection does not
  exist).
Graph Matrices for testing
Structured Programming and Testing

1. Loop Testing
2. Data Flow Testing
Loop testing
.
Four loops can be defined:
•Simple loops
•Concatenate loops
•Nested loops and
•Unstructured loops
Simple loop

• 7 different test cases made:
  –Skip loop entirely
  –Only one pass through loop
  –Two passes through loop
  –m passes through loop (m < n, where n
   is the maximum number)
  –n–1
  –n
  –n+1
Simple loop example

int i;
while (i >= 1 && i <= 10){
  i++;              i           Number of
                                iterations
}
                      0 or 11   0 (Skip loop entirely)
                      10        1 (one pass)
                      9         2 (two passes)
                      5         6 (pass M times)
                      2         9 (pass n – 1 times)
                      1         10 (pass n times)
                      0         0 (pass n + 1 times)
Nested loops

• Start with inner loop. Set all other loops to
  minimum values.
• Conduct simple loop testing on inner loop
• Work outwards
• Continue until all loops tested
Nested loops example

int n = 10;
for (int i = 0; i < n; i++){
  …
  for (int j = 0; j < n; j++){
     …
  }
  …
}
Concatenated loops

 • Concatenated loops can be tested
   using the approach defined for simple
   loops, if each of the loops is
   independent of the other.
 • However, if two loops are concatenated
   and the loop counter for loop 1 is used
   as the initial value for loop 2, then the
   loops are not independent.
 • When the loops are not independent,
   the approach applied to nested loops is
   recommended.
Concatenated Loops

• If independent loops, use simple loop
  testing
• If dependent, treat as nested loops
Concatenated loops example

int n   = 10;
int m   = 20;
while   (i < n){
  …
}
int j   = i;
while   (j < m){
  …
}
Unstructured loops

• This kind of loop must be redesigned instead of
  testing.
Data Flow Testing

• The data flow testing method selects test paths of
  a program according to the locations of definitions
  and uses of variables in the program
• Data flow testing is a powerful tool to detect
  improper use of data values due to coding errors
  – Incorrect assignment or input statement
  – Definition is missing (use of null definition)
  – Predicate is faulty (incorrect path is taken which leads
    to incorrect definition)

                                                               130
Data Flow Testing

Variables that contain data values have a defined life
 cycle: created, used, killed (destroyed).
The "scope" of the variable
      {           // begin outer block
           int x; // x is defined as an integer within this outer block
          ...;       // x can be accessed here
             {       // begin inner block
             int y; // y is defined within this inner block
          ...;       // both x and y can be accessed here
             }       // y is automatically destroyed at the end of
                     // this block
             ...; // x can still be accessed, but y is gone
          } // x is automatically destroyed

                                                                          131
The General Idea

• Data flow testing can be performed at two conceptual levels.
    – Static data flow testing
    – Dynamic data flow testing
• Static data flow testing
    – Identify potential defects, commonly known as data flow anomaly.
    – Analyze source code.
    – Do not execute code.
• Dynamic data flow testing
    – Involves actual program execution.
    – Bears similarity with control flow testing.
        • Identify paths to execute them.
        • Paths are identified based on data flow testing criteria.

  132
Data Flow Anomaly
    Anomaly: It is an abnormal way of doing something.
•       Example 1: The second definition of x overrides the first.
    –    x = f1(y);
         x = f2(z);


    Three types of abnormal situations with using variable.
•     Type 1: Defined and then defined again
    –
      Type 2: Undefined but referenced
    –
      Type 3: Defined but not referenced
    –




    133
Data flow analysis (DFA)’s
anomalies
 Detects Defines/reference anomalies, such as
   A variable that is defined but never used
     (unused variable)
   A variable that is used but never defined
     (undefined variable)
   A variable that is defined twice before it is used
     (redundant operations)
   Data reads from location not previously written to
     (uninitialized variables)
 The anomalies can be discovered by “static
  analysis”
Data Flow Testing

• Three possibilities exist for the first occurrence of
  a variable through a program path:
   – ~d - the variable does not exist (indicated by the ~),
     then it is defined (d)
   – ~u - the variable does not exist, then it is used (u)
   – ~k - the variable does not exist, then it is killed or
     destroyed (k)




                                                              135
Data Flow Testing

Time-sequenced pairs of defined (d), used (u), and killed
 (k):
  dd - Defined and defined again—not invalid but suspicious.
   Probably a programming error.
  du - Defined and used—perfectly correct. The normal case.
  dk - Defined and then killed—not invalid but probably a
   programming error.
  uu - Used and used again—acceptable.
  uk - Used and killed—acceptable.
  kd - Killed and defined—acceptable. A variable is killed and then
   redefined.
  ku - Killed and used—a serious defect. Using a variable that does
   not exist or is undefined is always an error.
  kk - Killed and killed—probably a programming error

                                                                       136
Data Flow Testing

   • A data flow graph is similar to a
     control flow graph in that it shows
     the processing flow through a
     module.
     In addition, it details the definition,
     use, and destruction of each of the
     module's variables.
   • Technique
      – Construct diagrams
      – Perform a static test of the diagram
      – Perform dynamic tests on the module    137
Data Flow Testing

Perform a static test of
 the diagram
 For each variable within the
  module we will examine
  define-use-kill patterns along
  the control flow paths
 The define-use-kill patterns
  for x (taken in pairs as we
  follow the paths) are:
     ~define - correct, the normal
      case
     define-define - suspicious,
      perhaps a programming error
     define-use - correct, the
      normal case
 

                                      138
Limitation

• The tester must have sufficient programming skill
  to understand the code and its control flow.
• Can be very time consuming because of all the
  modules and basis paths that comprise a system




                                                  139
Tabular Design Notation

• In many software applications, a module may be
  required to evaluate a complex combination of
  conditions and select appropriate actions based
  on these conditions.
• Decision tables provide a notation that translates
  actions and conditions into a tabular form.
Tabular Design Notation

• The table is difficult to misinterpret and may even
  be used as a machine readable input to a table
  driven algorithm.
Tabular Design Notation

• The table is divided into four sections.
Tabular Design Notation

• The upper left-hand quadrant contains a list of all
  conditions . The lower left-hand quadrant contains a
  list of all actions that are possible based on
  combinations of conditions.
Tabular Design Notation

• The right-hand quadrants form a matrix that indicates
  condition combinations and the corresponding actions that
  will occur for a specific combination. Therefore, each column
  of the matrix may be interpreted as a processing rule.
Tabular Design Notation

The following steps are applied to develop a decision table:
1. List all actions that can be associated with a specific
   procedure (or module).
2. List all conditions (or decisions made) during execution of the
   procedure.
Tabular Design Notation

•   Associate specific sets of conditions with specific actions, eliminating
    imposible combinations of conditions; alternatively, develop every
    possible permutation of conditions.
•   Define rules by indicating what action(s) occurs for a set of conditions.
Example

• If the customer account is billed using a fixed rate method, a
  minimum monthly charge is assessed for consumption of
  less than 100 KWH (kilowatt-hours).
• Otherwise, computer billing applies a Schedule A rate
  structure.
• However, if the account is billed using a variable rate
  method, a Schedule A rate structure will apply to
  consumption below 100 KWH, with additional consumption
  billed according to Schedule B
Program Design Language

• Program design language (PDL), also called
  structured English or pseudocode, is "a language
  in that it uses the vocabulary of one language (i.e.,
  English) and the overall syntax of a structured
  programming language.
• A program design language may be a simple
  transposition of a language such C.
Program Design Language

• At first glance PDL looks like a modern programming
  language.
• The difference between PDL and a real programming
  language lies in the use of narrative text (e.g., English)
  embedded directly within PDL statements.
• Given the use of narrative text embedded directly into a
  syntactical structure, PDL cannot be compiled (at least not
  yet).
• However, PDL tools currently exist to translate PDL into a
  programming language “skeleton” and/or a graphical
  representation (e.g., a flowchart) of design.
PDL characteristics

• A fixed syntax of keywords that provide for all structured
  constructs, data declaration, and modularity characteristics.
• A free syntax of natural language that describes processing
  features.
• Data declaration facilities that should include both simple
  (scalar, array) and complex (linked list or tree) data
  structures.
• Subprogram description and calling techniques that support
  various modes of interface description.
PDL characteristics

• A basic PDL syntax should include
  –   Interface description,
  –   Data declaration,
  –   Techniques for block structuring,
  –   Condition constructs,
  –   Repetition constructs,
  –   I/O constructs. The format and semantics for some of
      these
A PDL Example

• The system monitors alarms for fire, smoke,
  burglar, water, and temperature (e.g., furnace
  breaks while homeowner is away ) and produces
  an alarm bell and calls a monitoring service,
  generating a voice-synthesized message.
A PDL Example

• Recall that PDL is not a programming language.
  The designer can adapt as required without worry of
  syntax errors.
A PDL Example
A PDL Example
A PDL Example
A PDL Example

• Note that the designer for the security.monitor
  component has used a new construct PARBEGIN . .
  . ENDPAR that specifies a parallel block.
• All tasks specified within the PARBEGIN block are
  executed in parallel.
COMPARISON OF DESIGN
NOTATION

• Modularity. Design notation should support the
  development of modular software and provide a
  means for interface specification.
• Overall simplicity. Design notation should be
  relatively simple to learn, relatively easy to use,
  and generally easy to read.
• Ease of editing. The procedural design may
  require modification as the software process
  proceeds. The ease with which a design
  representation can be edited can help facilitate
  each software engineering task.
COMPARISON OF DESIGN
NOTATION

• Machine readability. Notation that can be input
  directly into a computer-based development system
  offers significant benefits.
• Maintainability. Software maintenance is the most
  costly phase of the software life cycle. Maintenance
  of the software configuration nearly always means
  maintenance       of    the     procedural     design
  representation.
COMPARISON OF DESIGN
NOTATION

• Structure enforcement. The benefits of a design
  approach that uses structured programming
  concepts have already been discussed. Design
  notation that enforces the use of only the structured
  constructs promotes good design practice.
• Automatic processing. A procedural design
  contains information that can be processed to give
  the designer new or better insights into the
  correctness and quality of a design. Such insight
  can be enhanced with reports provided via software
  design tools.
COMPARISON OF DESIGN
NOTATION

• Data representation. The ability to represent
  local and global data is an essential element of
  component-level design. Ideally, design notation
  should represent such data directly.
• Logic verification. Automatic verification of
  design logic is a goal that is paramount during
  software testing. Notation that enhances the ability
  to verify logic greatly improves testing adequacy.
COMPARISON OF DESIGN
NOTATION

• "Code-to" ability. The software engineering task
  that follows component-level design is code
  generation. Notation that may be converted easily
  to source code reduces effort and error.

Contenu connexe

Tendances

Quality assuarance bharath anche (1)
Quality assuarance bharath anche (1)Quality assuarance bharath anche (1)
Quality assuarance bharath anche (1)bharathanche
 
Testing types functional and nonfunctional - Kati Holasz
Testing types   functional and nonfunctional - Kati HolaszTesting types   functional and nonfunctional - Kati Holasz
Testing types functional and nonfunctional - Kati HolaszHolasz Kati
 
Software testing
Software testingSoftware testing
Software testingmkn3009
 
Software testing-and-analysis
Software testing-and-analysisSoftware testing-and-analysis
Software testing-and-analysisWBUTTUTORIALS
 
Introduction to software testing
Introduction to software testingIntroduction to software testing
Introduction to software testingHadi Fadlallah
 
Comparing Software Quality Assurance Techniques And Activities
Comparing Software Quality Assurance Techniques And ActivitiesComparing Software Quality Assurance Techniques And Activities
Comparing Software Quality Assurance Techniques And ActivitiesLemia Algmri
 
Software Testing Life Cycle
Software Testing Life CycleSoftware Testing Life Cycle
Software Testing Life Cyclegueste730d5
 
Software Quality Assurance and Testing at NIIT
Software Quality Assurance and Testing at NIITSoftware Quality Assurance and Testing at NIIT
Software Quality Assurance and Testing at NIITVikas Maheshwary
 
Quality of software
Quality of softwareQuality of software
Quality of softwarePalak Pandoh
 
Software testing basic concepts
Software testing basic conceptsSoftware testing basic concepts
Software testing basic conceptsHưng Hoàng
 
Software Testing and Quality Assurance unit1
Software Testing and Quality Assurance  unit1Software Testing and Quality Assurance  unit1
Software Testing and Quality Assurance unit1Bhagyashree Dhakulkar
 
16103271 software-testing-ppt
16103271 software-testing-ppt16103271 software-testing-ppt
16103271 software-testing-pptatish90
 
software testing
 software testing software testing
software testingSara shall
 
Tools for Software Verification and Validation
Tools for Software Verification and ValidationTools for Software Verification and Validation
Tools for Software Verification and Validationaliraza786
 

Tendances (20)

Quality assuarance bharath anche (1)
Quality assuarance bharath anche (1)Quality assuarance bharath anche (1)
Quality assuarance bharath anche (1)
 
Testing types functional and nonfunctional - Kati Holasz
Testing types   functional and nonfunctional - Kati HolaszTesting types   functional and nonfunctional - Kati Holasz
Testing types functional and nonfunctional - Kati Holasz
 
Softwaretesting
SoftwaretestingSoftwaretesting
Softwaretesting
 
Functional testing patterns
Functional testing patternsFunctional testing patterns
Functional testing patterns
 
Software testing
Software testingSoftware testing
Software testing
 
Software testing-and-analysis
Software testing-and-analysisSoftware testing-and-analysis
Software testing-and-analysis
 
Introduction to software testing
Introduction to software testingIntroduction to software testing
Introduction to software testing
 
Comparing Software Quality Assurance Techniques And Activities
Comparing Software Quality Assurance Techniques And ActivitiesComparing Software Quality Assurance Techniques And Activities
Comparing Software Quality Assurance Techniques And Activities
 
Software Testing Life Cycle
Software Testing Life CycleSoftware Testing Life Cycle
Software Testing Life Cycle
 
Software testing
Software testingSoftware testing
Software testing
 
Software Quality Assurance and Testing at NIIT
Software Quality Assurance and Testing at NIITSoftware Quality Assurance and Testing at NIIT
Software Quality Assurance and Testing at NIIT
 
Quality of software
Quality of softwareQuality of software
Quality of software
 
Software testing basic concepts
Software testing basic conceptsSoftware testing basic concepts
Software testing basic concepts
 
Software Testing and Quality Assurance unit1
Software Testing and Quality Assurance  unit1Software Testing and Quality Assurance  unit1
Software Testing and Quality Assurance unit1
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
16103271 software-testing-ppt
16103271 software-testing-ppt16103271 software-testing-ppt
16103271 software-testing-ppt
 
software testing
 software testing software testing
software testing
 
Qa analyst training
Qa analyst training Qa analyst training
Qa analyst training
 
Testing tools
Testing toolsTesting tools
Testing tools
 
Tools for Software Verification and Validation
Tools for Software Verification and ValidationTools for Software Verification and Validation
Tools for Software Verification and Validation
 

En vedette

Patent search from product specification final
Patent search from product specification finalPatent search from product specification final
Patent search from product specification finalIIITA
 
Se lect14 btech
Se lect14 btechSe lect14 btech
Se lect14 btechIIITA
 
Software Evolution_Se lect2 btech
Software Evolution_Se lect2 btechSoftware Evolution_Se lect2 btech
Software Evolution_Se lect2 btechIIITA
 
Se lect9 btech
Se lect9 btechSe lect9 btech
Se lect9 btechIIITA
 
Mse sept13 (3/3)
Mse sept13 (3/3)Mse sept13 (3/3)
Mse sept13 (3/3)IIITA
 
Software PROJECT MANAGEMENT_Se lect10 btech
Software PROJECT MANAGEMENT_Se lect10 btechSoftware PROJECT MANAGEMENT_Se lect10 btech
Software PROJECT MANAGEMENT_Se lect10 btechIIITA
 
Design dbms
Design dbmsDesign dbms
Design dbmsIIITA
 
CASE tools_Se lect15 btech
CASE tools_Se lect15 btechCASE tools_Se lect15 btech
CASE tools_Se lect15 btechIIITA
 
Se lect1 btech
Se lect1 btechSe lect1 btech
Se lect1 btechIIITA
 
Software Design_Se lect16 btech
Software Design_Se lect16 btechSoftware Design_Se lect16 btech
Software Design_Se lect16 btechIIITA
 
Mse july13 (1/3)
Mse july13 (1/3)Mse july13 (1/3)
Mse july13 (1/3)IIITA
 
Software Process Model_Se lect4 btech
Software Process Model_Se lect4 btechSoftware Process Model_Se lect4 btech
Software Process Model_Se lect4 btechIIITA
 
Software Production Layout_Se lect7 btech
Software Production Layout_Se lect7 btechSoftware Production Layout_Se lect7 btech
Software Production Layout_Se lect7 btechIIITA
 
Se lect13 btech
Se lect13 btechSe lect13 btech
Se lect13 btechIIITA
 

En vedette (15)

Patent search from product specification final
Patent search from product specification finalPatent search from product specification final
Patent search from product specification final
 
Se lect14 btech
Se lect14 btechSe lect14 btech
Se lect14 btech
 
Software Evolution_Se lect2 btech
Software Evolution_Se lect2 btechSoftware Evolution_Se lect2 btech
Software Evolution_Se lect2 btech
 
Se lect9 btech
Se lect9 btechSe lect9 btech
Se lect9 btech
 
Mse sept13 (3/3)
Mse sept13 (3/3)Mse sept13 (3/3)
Mse sept13 (3/3)
 
Software PROJECT MANAGEMENT_Se lect10 btech
Software PROJECT MANAGEMENT_Se lect10 btechSoftware PROJECT MANAGEMENT_Se lect10 btech
Software PROJECT MANAGEMENT_Se lect10 btech
 
Design dbms
Design dbmsDesign dbms
Design dbms
 
CASE tools_Se lect15 btech
CASE tools_Se lect15 btechCASE tools_Se lect15 btech
CASE tools_Se lect15 btech
 
Se lect1 btech
Se lect1 btechSe lect1 btech
Se lect1 btech
 
Lista de verbos para la ruta
Lista de verbos para la rutaLista de verbos para la ruta
Lista de verbos para la ruta
 
Software Design_Se lect16 btech
Software Design_Se lect16 btechSoftware Design_Se lect16 btech
Software Design_Se lect16 btech
 
Mse july13 (1/3)
Mse july13 (1/3)Mse july13 (1/3)
Mse july13 (1/3)
 
Software Process Model_Se lect4 btech
Software Process Model_Se lect4 btechSoftware Process Model_Se lect4 btech
Software Process Model_Se lect4 btech
 
Software Production Layout_Se lect7 btech
Software Production Layout_Se lect7 btechSoftware Production Layout_Se lect7 btech
Software Production Layout_Se lect7 btech
 
Se lect13 btech
Se lect13 btechSe lect13 btech
Se lect13 btech
 

Similaire à Software Quality and Testing_Se lect18 btech

SOFTWARE TESTING
SOFTWARE TESTINGSOFTWARE TESTING
SOFTWARE TESTINGRaju Raaj
 
Overview of Software QA and What is Software Quality
Overview of Software QA and What is Software QualityOverview of Software QA and What is Software Quality
Overview of Software QA and What is Software QualityUniversity of Dhaka
 
Software testing for beginners
Software testing for beginners Software testing for beginners
Software testing for beginners ssuser622d45
 
Software Testing Fundamentals
Software Testing FundamentalsSoftware Testing Fundamentals
Software Testing FundamentalsChankey Pathak
 
software testing and quality assurance .pdf
software testing and quality assurance .pdfsoftware testing and quality assurance .pdf
software testing and quality assurance .pdfMUSAIDRIS15
 
An introduction to Software Testing and Test Management
An introduction to Software Testing and Test ManagementAn introduction to Software Testing and Test Management
An introduction to Software Testing and Test ManagementAnuraj S.L
 
Software Testing - Software Quality
Software Testing - Software QualitySoftware Testing - Software Quality
Software Testing - Software QualityAjeng Savitri
 
Software Testing Training in Chandigarh
Software Testing Training in ChandigarhSoftware Testing Training in Chandigarh
Software Testing Training in ChandigarhKreativan Technologies
 
Software testing ppt
Software testing pptSoftware testing ppt
Software testing pptMansi Palav
 
Lecture 08 (SQE, Testing, PM, RM, ME).pptx
Lecture 08 (SQE, Testing, PM, RM, ME).pptxLecture 08 (SQE, Testing, PM, RM, ME).pptx
Lecture 08 (SQE, Testing, PM, RM, ME).pptxSirRafiLectures
 
Software Testing Interview Questions For Experienced
Software Testing Interview Questions For ExperiencedSoftware Testing Interview Questions For Experienced
Software Testing Interview Questions For Experiencedzynofustechnology
 

Similaire à Software Quality and Testing_Se lect18 btech (20)

Testing Plan
Testing PlanTesting Plan
Testing Plan
 
SOFTWARE TESTING
SOFTWARE TESTINGSOFTWARE TESTING
SOFTWARE TESTING
 
Overview of Software QA and What is Software Quality
Overview of Software QA and What is Software QualityOverview of Software QA and What is Software Quality
Overview of Software QA and What is Software Quality
 
stfbegn.ppt
stfbegn.pptstfbegn.ppt
stfbegn.ppt
 
Software testing for beginners
Software testing for beginners Software testing for beginners
Software testing for beginners
 
Software Testing Fundamentals
Software Testing FundamentalsSoftware Testing Fundamentals
Software Testing Fundamentals
 
Software Quality Management
Software Quality ManagementSoftware Quality Management
Software Quality Management
 
software testing and quality assurance .pdf
software testing and quality assurance .pdfsoftware testing and quality assurance .pdf
software testing and quality assurance .pdf
 
An introduction to Software Testing and Test Management
An introduction to Software Testing and Test ManagementAn introduction to Software Testing and Test Management
An introduction to Software Testing and Test Management
 
Software Testing - Software Quality
Software Testing - Software QualitySoftware Testing - Software Quality
Software Testing - Software Quality
 
QA Basics and PM Overview
QA Basics and PM OverviewQA Basics and PM Overview
QA Basics and PM Overview
 
Software Testing Training in Chandigarh
Software Testing Training in ChandigarhSoftware Testing Training in Chandigarh
Software Testing Training in Chandigarh
 
SQA_Class
SQA_ClassSQA_Class
SQA_Class
 
Software testing
Software testingSoftware testing
Software testing
 
Software testing ppt
Software testing pptSoftware testing ppt
Software testing ppt
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
software quality
software qualitysoftware quality
software quality
 
Lecture 08 (SQE, Testing, PM, RM, ME).pptx
Lecture 08 (SQE, Testing, PM, RM, ME).pptxLecture 08 (SQE, Testing, PM, RM, ME).pptx
Lecture 08 (SQE, Testing, PM, RM, ME).pptx
 
Software Quality
Software Quality Software Quality
Software Quality
 
Software Testing Interview Questions For Experienced
Software Testing Interview Questions For ExperiencedSoftware Testing Interview Questions For Experienced
Software Testing Interview Questions For Experienced
 

Dernier

4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesVijayaLaxmi84
 
ARTERIAL BLOOD GAS ANALYSIS........pptx
ARTERIAL BLOOD  GAS ANALYSIS........pptxARTERIAL BLOOD  GAS ANALYSIS........pptx
ARTERIAL BLOOD GAS ANALYSIS........pptxAneriPatwari
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfPrerana Jadhav
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxAneriPatwari
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxAnupam32727
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 

Dernier (20)

4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their uses
 
ARTERIAL BLOOD GAS ANALYSIS........pptx
ARTERIAL BLOOD  GAS ANALYSIS........pptxARTERIAL BLOOD  GAS ANALYSIS........pptx
ARTERIAL BLOOD GAS ANALYSIS........pptx
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
Narcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdfNarcotic and Non Narcotic Analgesic..pdf
Narcotic and Non Narcotic Analgesic..pdf
 
CHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptxCHEST Proprioceptive neuromuscular facilitation.pptx
CHEST Proprioceptive neuromuscular facilitation.pptx
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptxCLASSIFICATION OF ANTI - CANCER DRUGS.pptx
CLASSIFICATION OF ANTI - CANCER DRUGS.pptx
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 

Software Quality and Testing_Se lect18 btech

  • 2. What is quality ? Quality popular view: – Something “good” but not quantifiable – Something luxurious and classy Quality professional view: – Conformance to requirement (Crosby, 1979)  The requirements are clearly stated and the product must conform to it  Any deviation from the requirements is regarded as a defect  A good quality product contains fewer defects – Fitness for use (Juran, 1970):  Fit to user expectations: meet user’s needs  A good quality product provides better user satisfaction 2
  • 4. Definition of Quality ISO 8402 definition ISO 9216 Model: of QUALITY: Quality characteristics The totality of features and characteristics of a product 1.Functionality or a service that bear on 2.Reliability 3.Usability its ability to satisfy stated 4.Efficiency or implied needs 5.Maintainability 6.Portability 4
  • 6. Quality Concepts • Quality of design – refers to characteristics designers specify for the end product to be constructed • Quality of conformance – degree to which design specifications are followed in manufacturing the product • Quality control – series of inspections, reviews, and tests used to ensure conformance of a work product (artifact) to its specifications • Quality assurance – auditing and reporting procedures used to provide management with data needed to make proactive decisions 6
  • 8. Quality Control versus Quality Assurance • Quality Control (QC) is a set of activities carried out with the main objective of withholding products from shipment if they do not qualify. • Quality Assurance (QA) is meant to minimize the costs of quality by introducing a variety of activities throughout the development process and maintenance process in order to prevent the causes of errors, detect them, and correct them in the early stages of the development. As a result, quality assurance substantially reduces the rate of non-qualifying products. 8
  • 9. Quality as Dealing with defects • When people associate Quality or High Quality with software system, it is an indication that few, if any, defects are expected to occur during its operations or when problems do occur, the negative impact is expected to be minimized. • Key of the correctness aspect of software quality is the concept of defect, failure, fault and error. • The term “defect” refers to some problem with the software either with its external or with internal characteristics. 9
  • 11. Causes of software defects 1. Faulty requirements definition 2. Client-developer communication failures 3. Deliberate deviations from software requirements 4. Logical design errors 5. Coding errors 6. Non-compliance with documentation and coding instructions 7. Shortcomings of the testing process 8. User interface and procedure errors 9. Documentation errors 11
  • 12. Software errors, software faults and software failures Software development process software error software fault software failure 12
  • 13. Software errors, software faults and software failures More precisely: • An error can be a grammatical error in one or more of the code lines, or a logical error in carrying out one or more of the client’s requirements. • Not all software errors become software faults. in some cases, the software error can cause improper functioning of the software. In many other cases, erroneous code lines will not affect the functionality of the software as a whole. • A failure is said to occur whenever the external behavior of a system does not conform to that prescribed in the system specification. A software fault becomes a software failure only when it is “activated” 13
  • 15. Tools for Improving Quality • Formal specification • Self-checking code • Program verification and validation • Testing • Deploy with capabilities to repair
  • 16. Software Testing • Software testing is a popular risk management strategy. It is used to verify that functional requirements were met. • The limitation of this approach, however, is that by the time testing occurs, it is too late to build quality into the product 16
  • 17. What is Software Testing? “Testing is the process of establishing confidence that a program or system does what it is supposed to.” by Hetzel 1973 “Testing is the process of executing a program or system with the intent of finding errors.” by Myers 1979 “Testing is any activity aimed at evaluating an attribute or capability of a program or system and determining that it meets its required results.” by Hetzel 1983
  • 18. Testing is NOT • Code inspections • Design reviews • Configuration management • Bug tracking These are, along with testing, are part of Software Quality Assurance (SQA). Together these improve the quality of the product
  • 20. Types of Testing:  Scope  Execution  Unit  Manual  Module  Automated  Integration  Interface  Phases/Triggers  Coverage  Nightly Builds  Defect Removal  Purpose  Change Order Completion  Functional  Alpha  Stress  Beta
  • 21. WHO ARE THE TESTERS?
  • 22. Who Tests?  Developers  Unit testing  QA Team  Module testing, automated testing  Software  Automated testing  Designers  Engineers, Analysts  Users  Unpleasant but true
  • 25. Testing and debugging Testing is the process of determining if a program has any errors. When testing reveals an error, the process used to determine the cause of this error and to remove it, is known as debugging.
  • 27. WHAT I TEST PLAN
  • 28. Test plan A test cycle is often guided by a test plan. Example: The sort program is to be tested to meet the requirements given earlier. Specifically, the following needs to be done. • Execute sort on at least two input sequences, one with ``A'' and the other with ``D'' as request characters.
  • 29. Test plan (contd.) • Execute the program on an empty input sequence. • Test the program for robustness against erroneous inputs such as ``R'' typed in as the request character. • All failures of the test program should be recorded in a suitable file using the Company Failure Report Form.
  • 30. Test case/data A test case is a pair consisting of test data to be input to the program and the expected output. The test data is a set of values, one for each input variable. A test set is a collection of zero or more test cases. Sample test case for sort: Test data: <''A'’ 12 -29 32 > Expected output: -29 12 32
  • 32. Testing and verification Program verification aims at proving the correctness of programs by showing that it contains no errors. This is very different from testing that aims at uncovering errors in a program. Program verification and testing are best considered as complementary techniques. In practice, one can discard program verification, but not testing.
  • 33. Testing and verification (contd.) Testing is not a perfect technique in that a program might contain errors despite the success of a set of tests. Verification might appear to be perfect technique as it promises to verify that a program is free from errors. However, the person who verified a program might have made mistake in the verification process; there might be an incorrect assumption on the input conditions; incorrect assumptions might be made regarding the components that interface with the program, and so on.
  • 34. Software quality assurance and testing in Structured programming
  • 36. Structured Programming • structured programming: A technique for organizing and coding computer programs in which a hierarchy of modules is used. • Each having a single entry and a single exit point, and in which control is passed downward through the structure.
  • 37. STRUCTURED PROGRAMMING • In structured Programming each construct has a predictable logical structure. • This could enabling a reader to follow procedural flow more easily. • The constructs are sequence, condition, and repetition.
  • 38. STRUCTURED PROGRAMMING • Sequence implements processing steps that are essential in the specification of any algorithm. • Condition provides the facility for selected processing based on some logical occurrence. • Repetition allows for looping. • These three constructs are fundamental to structured programming—an important component-level design technique.
  • 39. STRUCTURED PROGRAMMING • The structured constructs were proposed to limit the procedural design of software to a small number of predictable operations. • Complexity metrics indicate that the use of the structured constructs reduces program complexity and thereby enhances readability, testability, and maintainability.
  • 40. STRUCTURED PROGRAMMING • The use of a limited number of logical constructs also contributes to a human understanding process that is known as chunking. • To understand this process, consider the way in which you are reading this page. • You do not read individual letters but rather recognize patterns or chunks of letters that form words or phrases.
  • 41. STRUCTURED PROGRAMMING • The structured constructs are logical chunks that allow a reader to recognize procedural elements of a module, rather than reading the design or code line by line. • Understanding is enhanced when readily recognizable logical patterns are encountered.
  • 42. STRUCTURED PROGRAMMING • Any program, regardless of application area or technical complexity, can be designed and implemented using only the three structured constructs. • It should be noted, however, that strict use of only these constructs can sometimes cause practical difficulties.
  • 43. Unstructured programming All the program code written in a single continuous main program. Many disadvantages for large programs • difficult to follow logic • if something needs to be done more than once must be re-typed • hard to incorporate other code • not easily modified • difficult to test particular portions of the code • ...
  • 45. Advantages of Structured Programming • Easy to write: Modular design increases the programmer's productivity by allowing them to look at the big picture first and focus on details later. Several Programmers can work on a single, large program, each working on a different module Studies show structured programs take less time to write than standard programs. Procedures written for one program can be reused in other programs requiring the same task. A procedure that can be used in many programs is said to be reusable
  • 46. Advantages of Structured Programming • Easy to debug Since each procedure is specialized to perform just one task, a procedure can be checked individually. Older unstructured programs consist of a sequence of instructions that are not grouped for specific tasks. The logic of such programs is cluttered with details and therefore difficult to follow. Easy to Understand The relationship between the procedures shows the modular design of the program. Easy to Change Since a correctly written structured program is self-documenting, it can be easily understood by another programmer.
  • 48. Graphical Design Notation • "A picture is worth a thousand words," but it's rather important to know which picture and which 1000 words. • There is no question that graphical tools, such as the flowchart or box diagram, provide useful pictorial patterns that readily depict procedural detail. • However, if graphical tools are misused, the wrong picture may lead to the wrong software.
  • 49. Graphical Design Notation • A flow chart is quite simple pictorially. • A box is used to indicate a processing step. • A diamond represents a logical condition, and arrows show the flow of control.
  • 50. Graphical Design Notation • The sequence is represented as two processing boxes connected by an line (arrow) of control.
  • 51. Graphical Design Notation • Condition, also called if-then-else, is shown as a decision diamond that if true, causes then-part processing to occur, and if false, invokes else-part processing.
  • 52. Graphical Design Notation • The selection (or select-case) construct shown in the figure is actually an extension of theif-then-else. A parameter is tested by successive decisions until a true condition occurs and a case part processing path is
  • 53. Graphical Design Notation • Repetition is represented using two slightly different forms. The do while tests a condition and executes a loop task repetitively as long as the condition holds true. • A repeat until executes the loop task first, then tests a condition and repeats the task until the condition fails.
  • 54. Graphical Design Notation • The structured constructs may be nested within one another as shown in Figure
  • 61. Structure Programming and testing (1) guarantee that all independent paths within a module have been exercised at least once, (2) exercise all logical decisions on their true and false sides, (3) execute all loops at their boundaries and within their operational bounds, and (4) exercise internal data structures to ensure their validity.
  • 63. Structure Programming and testing • BASIS PATH TESTING : Test cases derived to check the execution of every statement in the program at least one time during testing. – Flow Graph Notation – Cyclomatic Complexity – Deriving Test Cases – Graph Matrices
  • 64. What is Flow Graph Notation
  • 65. Flow Graph Notation • Draw a flow graph when the logical control structure of a module is complex. The flow graph enables you to trace program paths more readily.
  • 66. Types of Logic Coverage • Statement: each statement executed at least once • Branch: each branch traversed (and every entry point taken) at least once • Condition: each condition True at least once and False at least once • Branch/Condition: both Branch and Condition coverage achieved
  • 67. Types of Logic Coverage (cont’d) • Compound Condition: all combinations of condition values at every branch statement covered (and every entry point taken) • Path: all program paths traversed at least once
  • 68. Control Flow Graphs “nodes” “edges”
  • 69. Statement Coverage • Statement Coverage requires that each statement will have been executed at least once. • Simplest form of logic coverage. • Also known as Node Coverage.
  • 70. Statement Coverage • Statement should be executed completely or not at all. • For example: IF a THEN b ENDIF is considered as more than 1 statement since b may or may not be executed depending on the condition a.
  • 71. Branch Coverage • Branch Coverage requires that each branch will have been traversed, and that every program entry point will have been taken, at least once. • Also known as Edge Coverage.
  • 72. Branch Coverage • Attempting to cover all the paths in the software is called path coverage • The simplest form of path testing is called branch testing ________________________________ Print “Hello World” IF Date == “01-01-2005” THEN Print “Happy New Year” ELSE Print “Have a good day!” END IF Print “The date is: ”+Date Print “The time is: ”+Time END ________________________________ • To test each branch you would need to execute 2 test cases, one with the date set to 1st Jan 2005, and another with any other date.
  • 73. Condition Coverage • A branch predicate may have more than one condition. input(X,Y) if (Y<=0) or (X=0) then Y := -Y end_if while (Y>0) and (not EOF) do input(X) Y := Y-1 end_while
  • 74. Condition Coverage (cont’d) • Condition Coverage requires that each condition will have been True at least once and False at least once.
  • 75. Condition Coverage ________________________________ Print “Hello World” IF Date == “01-01-2005” AND Time ==“00:00:00” THEN Print “Happy New Year” ELSE Print “Have a good day!” END IF Print “The date is: ”+Date Print “The time is: ”+Time END ________________________________ • Condition Coverage takes extra conditions into consideration • To achieve full condition coverage you would need 4 test cases
  • 76. Branch/Condition Coverage • Branch/Condition Coverage requires that both Branch AND Condition Coverage will have been achieved. • Therefore, Branch/Condition Coverage subsumes both Branch Coverage and Condition Coverage.
  • 77. Compound Condition Coverage (cont’d) • Compound Condition Coverage requires that all combinations of condition values at every branch statement will have been covered, and that every entry point will have been taken, at least once. • Also know as Multiple Condition Coverage. • Subsumes Branch/Condition Coverage, regardless of the order in which conditions are evaluated.
  • 78. Path Coverage • Path Coverage requires that all program paths will have been traversed at least once. • Often described as the “strongest” form of logic coverage? • Path Coverage is usually impossible when loops are present. (How many test cases would be required to cover all paths in the example below?)
  • 79. Loop Coverage • Loop Coverage requires that the body of loops be executed 0, 1, 2, t, max, and max+1 times, where possible.
  • 80. Loop Coverage (cont’d) • Rationale: (cont’d) – Check loop re-initialization. – Check typical number of iterations. – Check upper (valid) bound on number of times body may be executed. – If the maximum can be exceeded, what behavior results?
  • 81. Flow Graph Notation • Each circle, called a flow graph node, represents one or more procedural statements. • A sequence of process boxes and a decision diamond can map into a single node. • The arrows on the flow graph, called edges or links, represent flow of control and are analogous to flowchart arrows.
  • 82. Flow Graph Notation • An edge must terminate at a node, even if the node does not represent any procedural statements (e.g., see the symbol for the if-then- else construct). • Areas bounded by edges and nodes are called regions. • When counting regions, we include the area outside the graph as a region.
  • 83. Flow Graph Notation • When compound conditions are encountered in a procedural design, the generation of a flow graph becomes slightly more complicated. • A compound condition occurs when one or more Boolean operators (logical OR, AND, NAND, NOR) is present in a conditional statement.
  • 84. Flow Graph Notation • Note that a separate node is created for each of the conditions a and b in the statement IF a OR b. • Each node that contains a condition is called a predicate node and is characterized by two or more edges emanating from it.
  • 85. How to draw Control flow graph? • Sequence: – 1 a=5; 1 – 2 b=a*b-1; 2 85
  • 86. How to draw Control flow graph? • Selection: – 1 if(a>b) then 1 – 2 c=3; – 3 else c=5; 2 3 – 4 c=c*c; 4 86
  • 87. How to draw Control flow graph? • Iteration: 1 – 1 while(a>b){ – 2 b=b*a; 2 – 3 b=b-1;} – 4 c=b+d; 3 4 87
  • 88. Example • int f1(int x,int y){ 1 • 1 while (x != y){ 2 • 2 if (x>y) then • 3 x=x-y; 3 4 • 4 else y=y-x; 5 • 5} • 6 6 return x; } 88
  • 89. How to draw Control flow graph? • Iteration: 1 – 1 while(a>b){ – 2 b=b*a; 2 – 3 b=b-1;} – 4 c=b+d; 3 4 89
  • 90. Cyclomatic Complexity • Cyclomatic complexity is a software metric that provides a quantitative measure of the logical complexity of a program. • It defines the number of independent paths in the basis set of a program and provides us with an upper bound for the number of tests that must be conducted to ensure that all statements have been executed at least once.
  • 92. Complexity is computed in one of three ways • The number of regions of the flow graph correspond to the cyclomatic complexity. • Cyclomatic complexity, V(G), for a flow graph, G, is defined as • where E is the number of flow graph edges, N is the number of flow graph nodes.
  • 93. Complexity is computed in one of three ways • Cyclomatic complexity, V(G), for a flow graph, G, is also defined as • where P is the number of predicate nodes contained in the flow graph G.
  • 94. Complexity is computed in one of three ways
  • 95. How to decide no. of test cases • More important, the value for V(G) provides us with an upper bound for the number of independent paths that form the basis set and, by implication, an upper bound on the number of tests that must be designed and executed to guarantee coverage of all program statements.
  • 96. How to derive test cases • Using the design or code as a foundation, draw a corresponding flow graph. • Determine the cyclomatic complexity of the resultant flow graph. • Determine a basis set of linearly independent paths. • Prepare test cases that will force execution of each path in the basis set.
  • 97. Example Control Flow Graph 1 2 3 4 5 6 Cyclomatic complexity = E-N+2 7-6+2 = 3. 97
  • 98. Cyclomatic complexity • Another way of computing cyclomatic complexity: – inspect control flow graph – determine number of bounded areas in the graph • V(G) = Total number of bounded areas + 1 98
  • 99. Example Control Flow Graph 1 2 3 4 5 6 From a visual examination of the CFG: the number of bounded areas is 2. 99 cyclomatic complexity = 2+1=3.
  • 100. Example • int f1(int x,int y){ • 1 while (x != y){ 1 • 2 if (x>y) then 2 • 3 x=x-y; • 4 else y=y-x; 3 4 • 5} 5 • 6 return x; } 6 • Number of independent paths: 3 – 1,6 test case (x=1, y=1) – 1,2,3,5,1,6 test case(x=1, y=2) 100 – 1,2,4,5,1,6 test case(x=2, y=1)
  • 101. 2 1. void myflow(int x, int y) { 3 2. int a; y == 0 y != 0 3. if (y == 0) { 4. a = 1; 4 6 5. } else { 6. a = y; 7 } 7. y = y – 1; 8. if (a > 0) { a>0 8 a≤0 9. a = x; 10. } else { 9 11 11. a = x + 1; } 12. printf(“%dn”, a); 12 } 101
  • 102. White-box Test Methods • Statement Coverage • Decision/Branch Coverage • Condition Coverage • Decision/Condition Coverage • Path Coverage
  • 103. Example Code Fragment • If ((A>1) & (B=0)) then Do; • X=X/A; • END; • If ((A==2) | (X>1)) then Do; • X=X+1; • END; • END;
  • 104. Statement Coverage • Exercise all statements at least once • How many test cases?  A=2 and B=0 (ace)
  • 105. Decision/Branch Coverage • Each decision has a true and a false outcome at least once • How many test cases?  A=2 and B=0 (ace)  A=1 and X=1 (abd)
  • 106. Condition Coverage • Each condition in a decision takes on all possible outcomes at least once • Conditions: A>1, B=0, A=2, X>1 • How many test cases?  A=2, B=0, and X=4 (ace)  A=1, B=1, and X=1 (abd)
  • 107. Decision/Condition Coverage • Each condition in a decision takes on all possible outcomes at least once, and each decision takes on all possible outcomes at least once • How many test cases?  A=2, B=0, and X=4 (ace)  A=1, B=1, and X=1 (abd) • What about these?  A=1, B=0, and X=3 (abe)  A=2, B=1, and X=1 (abe)
  • 108. Multiple Condition Coverage • Exercise all possible combinations of condition outcomes in each decision • Conditions: A>1, B=0 A=2, X>1 A>1, B<>0 A=2, X<=1 A<=1, B=0 A<>2, X>1 A<=1, B<>0 A<>2, X<=1
  • 109. Multiple Condition Coverage • How many test cases?  A=2, B=0, X=4 (ace)  A=2, B=1, X=1 (abe)  A=1, B=0, X=2 (abe)  A=1, B=1, X=1 (abd)
  • 110. Path Coverage • Every unique path through the program is executed at least once • How many test cases?  A=2, B=0, X=4 (ace)  A=2, B=1, X=1 (abe)  A=3, B=0, X=1 (acd)  A=1, B=1, X=1 (abd)
  • 111. Graph Matrices • A graph matrix is a square matrix whose size (i.e., number of rows and columns) is equal to the number of nodes on the flow graph. • Each row and column corresponds to an identified node, and matrix entries correspond to connections (an edge) between nodes.
  • 113. Graph Matrices • However, by adding a link weight to each matrix entry, the graph matrix can become a powerful tool for evaluating program control structure during testing. • The link weight provides additional information about control flow. • In its simplest form, the link weight is 1 (a connection exists) or 0 (a connection does not exist).
  • 116. Graph Matrices for testing • A graph matrix is a square matrix whose size (i.e., number of rows and columns) is equal to the number of nodes on the flow graph. • Each row and column corresponds to an identified node, and matrix entries correspond to connections (an edge) between nodes.
  • 117. Graph Matrices for testing
  • 118. Graph Matrices for testing • However, by adding a link weight to each matrix entry, the graph matrix can become a powerful tool for evaluating program control structure during testing. • The link weight provides additional information about control flow. • In its simplest form, the link weight is 1 (a connection exists) or 0 (a connection does not exist).
  • 119. Graph Matrices for testing
  • 120. Structured Programming and Testing 1. Loop Testing 2. Data Flow Testing
  • 121. Loop testing . Four loops can be defined: •Simple loops •Concatenate loops •Nested loops and •Unstructured loops
  • 122. Simple loop • 7 different test cases made: –Skip loop entirely –Only one pass through loop –Two passes through loop –m passes through loop (m < n, where n is the maximum number) –n–1 –n –n+1
  • 123. Simple loop example int i; while (i >= 1 && i <= 10){ i++; i Number of iterations } 0 or 11 0 (Skip loop entirely) 10 1 (one pass) 9 2 (two passes) 5 6 (pass M times) 2 9 (pass n – 1 times) 1 10 (pass n times) 0 0 (pass n + 1 times)
  • 124. Nested loops • Start with inner loop. Set all other loops to minimum values. • Conduct simple loop testing on inner loop • Work outwards • Continue until all loops tested
  • 125. Nested loops example int n = 10; for (int i = 0; i < n; i++){ … for (int j = 0; j < n; j++){ … } … }
  • 126. Concatenated loops • Concatenated loops can be tested using the approach defined for simple loops, if each of the loops is independent of the other. • However, if two loops are concatenated and the loop counter for loop 1 is used as the initial value for loop 2, then the loops are not independent. • When the loops are not independent, the approach applied to nested loops is recommended.
  • 127. Concatenated Loops • If independent loops, use simple loop testing • If dependent, treat as nested loops
  • 128. Concatenated loops example int n = 10; int m = 20; while (i < n){ … } int j = i; while (j < m){ … }
  • 129. Unstructured loops • This kind of loop must be redesigned instead of testing.
  • 130. Data Flow Testing • The data flow testing method selects test paths of a program according to the locations of definitions and uses of variables in the program • Data flow testing is a powerful tool to detect improper use of data values due to coding errors – Incorrect assignment or input statement – Definition is missing (use of null definition) – Predicate is faulty (incorrect path is taken which leads to incorrect definition) 130
  • 131. Data Flow Testing Variables that contain data values have a defined life cycle: created, used, killed (destroyed). The "scope" of the variable { // begin outer block int x; // x is defined as an integer within this outer block ...; // x can be accessed here { // begin inner block int y; // y is defined within this inner block ...; // both x and y can be accessed here } // y is automatically destroyed at the end of // this block ...; // x can still be accessed, but y is gone } // x is automatically destroyed 131
  • 132. The General Idea • Data flow testing can be performed at two conceptual levels. – Static data flow testing – Dynamic data flow testing • Static data flow testing – Identify potential defects, commonly known as data flow anomaly. – Analyze source code. – Do not execute code. • Dynamic data flow testing – Involves actual program execution. – Bears similarity with control flow testing. • Identify paths to execute them. • Paths are identified based on data flow testing criteria. 132
  • 133. Data Flow Anomaly Anomaly: It is an abnormal way of doing something. • Example 1: The second definition of x overrides the first. – x = f1(y); x = f2(z); Three types of abnormal situations with using variable. • Type 1: Defined and then defined again – Type 2: Undefined but referenced – Type 3: Defined but not referenced – 133
  • 134. Data flow analysis (DFA)’s anomalies  Detects Defines/reference anomalies, such as  A variable that is defined but never used  (unused variable)  A variable that is used but never defined  (undefined variable)  A variable that is defined twice before it is used  (redundant operations)  Data reads from location not previously written to  (uninitialized variables)  The anomalies can be discovered by “static analysis”
  • 135. Data Flow Testing • Three possibilities exist for the first occurrence of a variable through a program path: – ~d - the variable does not exist (indicated by the ~), then it is defined (d) – ~u - the variable does not exist, then it is used (u) – ~k - the variable does not exist, then it is killed or destroyed (k) 135
  • 136. Data Flow Testing Time-sequenced pairs of defined (d), used (u), and killed (k):  dd - Defined and defined again—not invalid but suspicious. Probably a programming error.  du - Defined and used—perfectly correct. The normal case.  dk - Defined and then killed—not invalid but probably a programming error.  uu - Used and used again—acceptable.  uk - Used and killed—acceptable.  kd - Killed and defined—acceptable. A variable is killed and then redefined.  ku - Killed and used—a serious defect. Using a variable that does not exist or is undefined is always an error.  kk - Killed and killed—probably a programming error 136
  • 137. Data Flow Testing • A data flow graph is similar to a control flow graph in that it shows the processing flow through a module. In addition, it details the definition, use, and destruction of each of the module's variables. • Technique – Construct diagrams – Perform a static test of the diagram – Perform dynamic tests on the module 137
  • 138. Data Flow Testing Perform a static test of the diagram For each variable within the module we will examine define-use-kill patterns along the control flow paths The define-use-kill patterns for x (taken in pairs as we follow the paths) are: ~define - correct, the normal case define-define - suspicious, perhaps a programming error define-use - correct, the normal case  138
  • 139. Limitation • The tester must have sufficient programming skill to understand the code and its control flow. • Can be very time consuming because of all the modules and basis paths that comprise a system 139
  • 140. Tabular Design Notation • In many software applications, a module may be required to evaluate a complex combination of conditions and select appropriate actions based on these conditions. • Decision tables provide a notation that translates actions and conditions into a tabular form.
  • 141. Tabular Design Notation • The table is difficult to misinterpret and may even be used as a machine readable input to a table driven algorithm.
  • 142. Tabular Design Notation • The table is divided into four sections.
  • 143. Tabular Design Notation • The upper left-hand quadrant contains a list of all conditions . The lower left-hand quadrant contains a list of all actions that are possible based on combinations of conditions.
  • 144. Tabular Design Notation • The right-hand quadrants form a matrix that indicates condition combinations and the corresponding actions that will occur for a specific combination. Therefore, each column of the matrix may be interpreted as a processing rule.
  • 145. Tabular Design Notation The following steps are applied to develop a decision table: 1. List all actions that can be associated with a specific procedure (or module). 2. List all conditions (or decisions made) during execution of the procedure.
  • 146. Tabular Design Notation • Associate specific sets of conditions with specific actions, eliminating imposible combinations of conditions; alternatively, develop every possible permutation of conditions. • Define rules by indicating what action(s) occurs for a set of conditions.
  • 147. Example • If the customer account is billed using a fixed rate method, a minimum monthly charge is assessed for consumption of less than 100 KWH (kilowatt-hours). • Otherwise, computer billing applies a Schedule A rate structure. • However, if the account is billed using a variable rate method, a Schedule A rate structure will apply to consumption below 100 KWH, with additional consumption billed according to Schedule B
  • 148.
  • 149. Program Design Language • Program design language (PDL), also called structured English or pseudocode, is "a language in that it uses the vocabulary of one language (i.e., English) and the overall syntax of a structured programming language. • A program design language may be a simple transposition of a language such C.
  • 150. Program Design Language • At first glance PDL looks like a modern programming language. • The difference between PDL and a real programming language lies in the use of narrative text (e.g., English) embedded directly within PDL statements. • Given the use of narrative text embedded directly into a syntactical structure, PDL cannot be compiled (at least not yet). • However, PDL tools currently exist to translate PDL into a programming language “skeleton” and/or a graphical representation (e.g., a flowchart) of design.
  • 151. PDL characteristics • A fixed syntax of keywords that provide for all structured constructs, data declaration, and modularity characteristics. • A free syntax of natural language that describes processing features. • Data declaration facilities that should include both simple (scalar, array) and complex (linked list or tree) data structures. • Subprogram description and calling techniques that support various modes of interface description.
  • 152. PDL characteristics • A basic PDL syntax should include – Interface description, – Data declaration, – Techniques for block structuring, – Condition constructs, – Repetition constructs, – I/O constructs. The format and semantics for some of these
  • 153. A PDL Example • The system monitors alarms for fire, smoke, burglar, water, and temperature (e.g., furnace breaks while homeowner is away ) and produces an alarm bell and calls a monitoring service, generating a voice-synthesized message.
  • 154. A PDL Example • Recall that PDL is not a programming language. The designer can adapt as required without worry of syntax errors.
  • 158. A PDL Example • Note that the designer for the security.monitor component has used a new construct PARBEGIN . . . ENDPAR that specifies a parallel block. • All tasks specified within the PARBEGIN block are executed in parallel.
  • 159. COMPARISON OF DESIGN NOTATION • Modularity. Design notation should support the development of modular software and provide a means for interface specification. • Overall simplicity. Design notation should be relatively simple to learn, relatively easy to use, and generally easy to read. • Ease of editing. The procedural design may require modification as the software process proceeds. The ease with which a design representation can be edited can help facilitate each software engineering task.
  • 160. COMPARISON OF DESIGN NOTATION • Machine readability. Notation that can be input directly into a computer-based development system offers significant benefits. • Maintainability. Software maintenance is the most costly phase of the software life cycle. Maintenance of the software configuration nearly always means maintenance of the procedural design representation.
  • 161. COMPARISON OF DESIGN NOTATION • Structure enforcement. The benefits of a design approach that uses structured programming concepts have already been discussed. Design notation that enforces the use of only the structured constructs promotes good design practice. • Automatic processing. A procedural design contains information that can be processed to give the designer new or better insights into the correctness and quality of a design. Such insight can be enhanced with reports provided via software design tools.
  • 162. COMPARISON OF DESIGN NOTATION • Data representation. The ability to represent local and global data is an essential element of component-level design. Ideally, design notation should represent such data directly. • Logic verification. Automatic verification of design logic is a goal that is paramount during software testing. Notation that enhances the ability to verify logic greatly improves testing adequacy.
  • 163. COMPARISON OF DESIGN NOTATION • "Code-to" ability. The software engineering task that follows component-level design is code generation. Notation that may be converted easily to source code reduces effort and error.

Notes de l'éditeur

  1. Need to focus some testing effort on these as well (not a focus of coverage-based testing) – Explore the sequences of events related to the data state and the unreasonable things that can happen to data. – Explore the effect of using the value produced by each and every computation
  2. Handouts
  3. Handouts
  4. The first is correct. The variable does not exist and then it is defined. The second is incorrect. A variable must not be used before it is defined. The third is probably incorrect. Destroying a variable before it is created is indicative of a programming error. d – defined, created, initialized Data declaration; on left hand side of computation k – killed, undefined, released u – used for something (=c and p) c - Right hand side of computation, pointer (calculation) p - Used in a predicate (or as control variable of loop)
  5. - dd – why define twice without use? - du – normal (a “du pair”) - dk -- why define and kill without use? - ud – usually normal, reassignment after use - uu – normal - uk – normal kd – normal (kill then redefine) ku – a bug; killed then used kk – harmless but probably a bug Often these anomalies are caught by compilers or static analyzers today – depending upon the language
  6. First, we will perform a static test of the diagram. By &quot;static&quot; we mean we examine the diagram (formally through inspections or informally through look-sees). Second, we perform dynamic tests on the module. By &quot;dynamic&quot; we mean we construct and execute test cases
  7. Modified?????