Lecture for Chapter 9, Testing

Document Sample
scope of work template
							     Object-Oriented Software
Conquering Complex and Changing Systems
            Engineering    Chapter 11,
                           Unit Testing
   Testing Activities

Subsystem                                                                                  Requirements
                         Unit                       System
  Code                   Test                                                                Analysis
                                                    Design                                  Document
                                     Tested        Document                                                                User
                                     Subsystem
Subsystem                                                                                                                 Manual
                         Unit
  Code                   Test
                                  Tested           Integration
                                  Subsystem                                                      Functional
                                                       Test                                        Test
                                                                           Integrated                                    Functioning
                                                                          Subsystems                                       System

                                    Tested Subsystem

Subsystem                Unit
  Code                   Test
                                                                         All tests by developer
        Detailed Source Code
         Design   (whitebox)
       (blackbox)
   Bernd Bruegge & Allen Dutoit          Object-Oriented Software Engineering: Conquering Complex and Changing Systems         2
  Testing Activities ctd

                                                     Client’s
                 Global                           Understanding                                      User
              Requirements                       of Requirements                                  Environment


                  Validated                                                Accepted
Functioning
                   System                                                   System
  System Performance                            Acceptance                                     Installation
                           Test                   Test                                            Test

                                                                                                                  Usable
                                                            Tests by client                                       System
   Tests by developer
                                               User’s understanding
                                                                                                  System in
                                                                                                    Use
                                                       Tests (?) by user
  Bernd Bruegge & Allen Dutoit    Object-Oriented Software Engineering: Conquering Complex and Changing Systems        3
Unit Testing
   Informal:
      Incremental coding
   Static Analysis:
         Hand execution: Reading the source code
         Walk-Through (informal presentation to others)
         Code Inspection (formal presentation to others)
         Automated Tools checking for
            syntactic and semantic errors

            departure from coding standards

   Dynamic Analysis:
      Black-box testing (Test the input/output behavior)
      White-box testing (Test the internal logic of the subsystem or
       object)
      Data-structure based testing (Data types determine test
       cases)
Bernd Bruegge & Allen Dutoit   Object-Oriented Software Engineering: Conquering Complex and Changing Systems   4
 The 4 Testing Steps (presented before)
1. Select what has to be                                   3. Develop test cases
  measured                                                        A test case is a set of test
 Code tested for
                                                                   data or situations that will
                                                                   be used to exercise the
  correctness with respect                                         unit (code, module,
  to:                                                              system) being tested or
      requirements                                                about the attribute being
                                                                   measured
      architecture
      detailed design                                     4. Create the test oracle
                                                                  An oracle contains of the
2. Decide how the testing is                                       predicted results for a set
  done for each level of                                           of test cases
  testing                                                                 I.e., expected output for
       Code inspection                                                    each test
       Black-box, white box,                                               The test oracle has to be
                                                                                written down before the
       Select integration testing
                                                                                actual testing takes place
           strategy (big bang,
           bottom up, top down,                                             This is the difficult step
           sandwich)
 Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 5
 Black-box Testing

   Focus: I/O behavior. If for any given input, we can predict
    the output, then the module passes the test.
        Almost always impossible to generate all possible inputs
         ("test cases")
        need techniques to define the input values
   Derive tests using the detailed design
   Goal: Reduce number of test cases by equivalence
    partitioning:
        Divide input conditions into equivalence classes
        Choose test cases for each equivalence class. (Example: If
         an object is supposed to accept a negative number, testing
         one negative number is enough)



Bernd Bruegge & Allen Dutoit   Object-Oriented Software Engineering: Conquering Complex and Changing Systems   6
Black-box Testing (Continued)

   Selection of equivalence classes (No rules, only
    guidelines):
      Input is valid across range of values. Select test cases from
       3 equivalence classes:
                 Below the range
                 Within the range
                 Above the range
      Input is valid if it is from a discrete set. Select test cases
       from 2 equivalence classes:
                 Valid discrete value
                 Invalid discrete value
   Another solution to select only a limited amount of test
    cases:
      Get knowledge about the inner workings of the unit being
       tested => white-box testing

Bernd Bruegge & Allen Dutoit     Object-Oriented Software Engineering: Conquering Complex and Changing Systems   7
White-box Testing
 Focus: Thoroughness (Coverage)
 Derive tests using the source code
 Four types of white-box testing
   Statement Testing
   Loop Testing
   Path Testing
   Branch Testing




Bernd Bruegge & Allen Dutoit   Object-Oriented Software Engineering: Conquering Complex and Changing Systems   8
White-box Testing (Continued)
   Statement Testing:
        Select and test single statements
   Loop Testing:
        Cause execution of the loop to be skipped completely
                   Note. cannot do this on repeat until loops
        Loop to be executed exactly once
        Loop to be executed more than once
   Path testing:
        Make sure all paths in the program are executed
   Branch Testing (Conditional Testing): Make sure that
    each possible outcome from a condition is tested at least
    once
                          if ( i =TRUE) printf("YES\n");elseprintf("NO\n");
                         Test cases: 1) i = TRUE; 2) i = FALSE


Bernd Bruegge & Allen Dutoit        Object-Oriented Software Engineering: Conquering Complex and Changing Systems   9
Unit Level
   We can use the same testing approaches (whitebox,
    blackbox) in testing the classes
   The same testing activities occur, but now they are
    applied at a lower level of abstraction




Bernd Bruegge & Allen Dutoit   Object-Oriented Software Engineering: Conquering Complex and Changing Systems   10

						
Related docs
Other docs by rogerholland
Tapan H
Views: 10  |  Downloads: 0
Anastasia Kurdia - PDF
Views: 265  |  Downloads: 0
Mary Beth Goodrich - DOC
Views: 31  |  Downloads: 0
Call to order Roll Call Present Ben Dower, Ana
Views: 12  |  Downloads: 0
Chapter 8 The Maximum Principle Discrete Time
Views: 30  |  Downloads: 0
To Cancel A QuickTrip Reservation
Views: 4  |  Downloads: 0
Linking Science and Local Knowledge
Views: 16  |  Downloads: 2
Higher Order Differential Equations
Views: 4  |  Downloads: 0
Analysis - PowerPoint
Views: 570  |  Downloads: 8