CHAPTER 17 SOFTWARE TESTING STRATEGIES 1 TOPICS u

  • Slides: 35
Download presentation
CHAPTER 17 SOFTWARE TESTING STRATEGIES 1

CHAPTER 17 SOFTWARE TESTING STRATEGIES 1

TOPICS u. A strategic approach to software testing u Unit Testing u Integration Testing

TOPICS u. A strategic approach to software testing u Unit Testing u Integration Testing u Validation Testing u System Testing u The ART of Debugging u Summary 2 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

STRATEGIC APPROACH TO SOFTWARE TESTING Generic characteristics of software testing strategies: u Testing begins

STRATEGIC APPROACH TO SOFTWARE TESTING Generic characteristics of software testing strategies: u Testing begins at module level and works outward towards the of integration entire computer based system. u Different testing techniques are required at different points in time. u Testing is conducted by the s/w developer and ITG ( Independent Test Group ) for large projects. u Testing and Debugging are different and Debugging is essential in any testing strategy. 3 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

Verification and Validation u Verification -- Does the product meet its specifications? u Validation

Verification and Validation u Verification -- Does the product meet its specifications? u Validation -- Does the product perform as desired? December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil 4

Software Testing Strategy A Software Testing Strategy 5 December 28, 1997 R. A. Volz

Software Testing Strategy A Software Testing Strategy 5 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

Software Testing Strategy 6 December 28, 1997 R. A. Volz -- Assistance - Nirmal

Software Testing Strategy 6 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

Software Error Model u f(t) = cumulative remaining u l 0 = initial failure

Software Error Model u f(t) = cumulative remaining u l 0 = initial failure rate up errors at time t = exponential reduction as errors repaired f(t) = (1/p)ln(l 0 pt + 1) 7 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

STRATEGIC APPROACH u Issues to be addressed to develop a successful software testing strategy:

STRATEGIC APPROACH u Issues to be addressed to develop a successful software testing strategy: u Specify product requirements in a quantifiable manner long before testing commences. u State testing objectives explicitly. u Understand the users of the software. u Develop testing plan that emphasizes “rapid cycle testing. ” 8 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

STRATEGIC APPROACH u Issues to be addressed to develop a successful software testing strategy:

STRATEGIC APPROACH u Issues to be addressed to develop a successful software testing strategy: u Build robust software that is designed to test itself. u Use effective formal technical reviews as a filter to testing. u Conduct formal technical reviews to assess test strategy and test cases. u Develop continuous improvement approach 9 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

UNIT TESTING u Unit testing -- focuses on the smallest element of software design

UNIT TESTING u Unit testing -- focuses on the smallest element of software design viz. the module. u Corresponds u Makes to class testing in the OO context. heavy use of white-box testing. 10 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

UNIT TESTING Unit Test Generation Considerations: Review Design information - develop unit test cases.

UNIT TESTING Unit Test Generation Considerations: Review Design information - develop unit test cases. interface local data structures boundary conditions independent paths error handling paths driver Module to be tested stub Test cases 11 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

Unit Test Generation u Interface considerations u# of input parameters = # arguments? u

Unit Test Generation u Interface considerations u# of input parameters = # arguments? u Parameter and argument attributes match? u Parameter and argument units match? u Order correct (if important)? u Number and order of arguments for built-ins? u References to parms not associated with entry point? u Attempt to modify input-only arguments? u Global variable definitions consistent? R. A. Volzas -- Assistance - Nirmal Patil December 28, 1997 u Constraints passed arguments? 12

Unit Test Generation u External I/O considerations u Files attributes correct? u OPEN/CLOSE correct?

Unit Test Generation u External I/O considerations u Files attributes correct? u OPEN/CLOSE correct? Format specification matches I/O statement? u Buffer size matches record size? u Files opened before use? u EOF handled correctly? I/O errors handled? u Textual errors in output? 13 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

Unit Test Generation u Data structure considerations u Improper or inconsistent typing? u Erroneous

Unit Test Generation u Data structure considerations u Improper or inconsistent typing? u Erroneous initialization or default values? u Incorrect variable names? u Inconsistent data types? u Underflow, overflow and addressing exceptions? 14 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

Unit Test Generation u Test cases must cover all execution paths u Common computational

Unit Test Generation u Test cases must cover all execution paths u Common computational errors to be checked: u incorrect arithmetic u mixed mode operations u incorrect initialization u precision inaccuracy u incorrect symbolic representation u Other of expression tests needed u incompatible data types in comparisons u incorrect logical operators or precedence u comparison problems (e. g. , == on floats) u loop problems December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil 15

Unit Test Generation u Error handling tests u Exception-handling is incorrect? u Error description

Unit Test Generation u Error handling tests u Exception-handling is incorrect? u Error description is unintelligible, insufficient or incorrect? u Error condition causes system interrupt before error handling completed? 16 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

INTEGRATION TESTING u. A systematic approach for constructing program structure while conducting tests to

INTEGRATION TESTING u. A systematic approach for constructing program structure while conducting tests to uncover errors associated with interfacing. u Tendency for Non-Incremental integration. . Big Bang approach …. Chaos !! ( usually ). u Incremental integration - program is constructed and tested in small segments. u Top-Down Integration testing u Bottom-Up Integration testing 17 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

INTEGRATION TESTING 18 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

INTEGRATION TESTING 18 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

INTEGRATION TESTING Top-Down Approach u Begin construction and testing with main module. u Stubs

INTEGRATION TESTING Top-Down Approach u Begin construction and testing with main module. u Stubs are substituted for all subordinate modules. u Subordinate stubs are replaced one at a time by actual modules. u Tests are conducted as each module is integrated. u On completion of each set of tests, another stub is replaced with the real module. u Regression testing may be conducted to ensure that new errors have not been introduced. 19 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

Top Down Approach - Use Stubs 20 December 28, 1997 R. A. Volz --

Top Down Approach - Use Stubs 20 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

INTEGRATION TESTING Top-Down Approach : u Advantages: u Verifies major control or decision points

INTEGRATION TESTING Top-Down Approach : u Advantages: u Verifies major control or decision points early in the test process. u With the use of depth-first integration testing, a complete function of the software can be demonstrated. -- Confidence builder for developer/customer. u Disadvantages: u Since stubs replace lower level modules, no significant data can flow upwards to the main module. December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil 21

INTEGRATION TESTING Bottom Up Approach : u This approach begins construction and testing with

INTEGRATION TESTING Bottom Up Approach : u This approach begins construction and testing with modules at the lowest levels in the program structure. u Low-level modules are combined into clusters. u A driver is written to coordinate test case input and output. u The cluster is tested. u Drivers are removed and clusters are combined moving upward in the program hierarchy. 22 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

Bottom Up Approach 23 December 28, 1997 R. A. Volz -- Assistance - Nirmal

Bottom Up Approach 23 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

INTEGRATION TESTING Bottom Up Approach u Advantages: u Easier test case design and lack

INTEGRATION TESTING Bottom Up Approach u Advantages: u Easier test case design and lack of stubs. u Disadvantages: u The program as an entity is does not exist until the last module is added. Sandwich Testing: - combined approach u Top down strategy for upper levels and Bottom up strategy for subordinate levels. 24 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

INTEGRATION TESTING u Regression Testing u Re-execution of some subset of tests already conducted

INTEGRATION TESTING u Regression Testing u Re-execution of some subset of tests already conducted to ensure that the new changes do not have unintended side effects. u The Regression test suite should contain three different classes of test cases : u A representative sample of tests that will exercise all software functions u Additional tests that focus on functions that are likely to be affected by the change. u Tests that focus on software components that have changed. 25 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

INTEGRATION TESTING Integration Test Documentation 1 Scope of testing 2 Test plan 3 4

INTEGRATION TESTING Integration Test Documentation 1 Scope of testing 2 Test plan 3 4 5 Test Procedure n Actual Test Results Ref. & Appendix Environment Test Schedule Unit Test / Resources phases test case Overhead and data Test software builds environment Order of Integration Expected Results for build n 26 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

VALIDATION TESTING u It provides final assurance that software meets all functional, behavioral, and

VALIDATION TESTING u It provides final assurance that software meets all functional, behavioral, and performance requirements. -- Exclusive use of Black-box testing techniques. u After each validation test case either software conforms to specs or a deviation from specs is detected and a deficiency list needs to be worked. u Alpha and Beta testing u Alpha test -- At developer’s site by customer. u Beta test -- At customer’s site in a “live” environment. 27 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

SYSTEM TESTING u. A series of tests to verify that all system elements have

SYSTEM TESTING u. A series of tests to verify that all system elements have been properly integrated. u Recovery Testing: u Forces software to fail in a variety of ways and verifies that recovery is properly performed. u Security Testing: u Attempts to verify the software’s protection mechanisms. The software designer tries to make penetration cost more than the value of information obtained by breaking in. 28 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

SYSTEM TESTING u Stress Testing: u Executes the system in a manner that demands

SYSTEM TESTING u Stress Testing: u Executes the system in a manner that demands resources in abnormal quantity, frequency or volume. u Performance Testing: u To test the run time performance of a system within the context of an integrated system. 29 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

CLCS Test Approach Operations Environment User Acceptance Tests System S/W Validation Tests System Delivery

CLCS Test Approach Operations Environment User Acceptance Tests System S/W Validation Tests System Delivery COTS H/W on Dock Acceptance Test System Test User App S/W Validation Tests User Eval CSCI Int Test Integration Environment Developers Early Unit Integ User Eval Test System Integration and Test Group Validation Group Unit Design Test Application S/W IPT Development Environment Users

THE ART OF DEBUGGING u Debugging is a consequence of successful testing -- when

THE ART OF DEBUGGING u Debugging is a consequence of successful testing -- when a test case uncovers an error, it is the debugging process that results in the removal of the error. u Debugging is an ART. The external manifestation of the error and the cause of the error normally do not share an obvious relationships. 31 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

THE ART OF DEBUGGING The Debugging process Execution of test cases Test cases Additional

THE ART OF DEBUGGING The Debugging process Execution of test cases Test cases Additional tests Regression tests Corrections Results Suspected causes Identified causes Debugging 32 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

THE ART OF DEBUGGING u Debugging u Brute Approaches force : - Take memory

THE ART OF DEBUGGING u Debugging u Brute Approaches force : - Take memory dumps, invoke run time traces. Least efficient and quite common. u Backtracking : - Once an error is uncovered, trace your way back to the cause of the error. u Cause Elimination : - Isolate potential causes, devise cause hypotheses tests to isolate bug. u Use of debugging tools 33 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

COMMENTS u Should the software developer be involved with testing ? u Developer’s have

COMMENTS u Should the software developer be involved with testing ? u Developer’s have a vested interest in demonstrating that their software is error-free. u Developer’s (psychologically) feel that testing is destructive. u When are we done with testing ? u “You are never done with testing, the burden shifts from you to the customer. ” 34 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil

SUMMARY u Software Testing accounts for the largest percentage of technical effort in the

SUMMARY u Software Testing accounts for the largest percentage of technical effort in the software process. u Objective of Software testing -- To uncover errors, maintain software quality. u Steps : Unit, Integration, Validation, System. u Debugging is often an art and the most valuable resource is often the counsel of other software engineers. 35 December 28, 1997 R. A. Volz -- Assistance - Nirmal Patil