Agenda Introduction Overview of White-box testing Basis path testing

Slides:



Advertisements
Similar presentations
Software Testing Techniques
Advertisements

Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
Software Testing Technique. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves.
Chapter 14 Testing Tactics
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Creator: ACSession No: 13 Slide No: 1Reviewer: SS CSE300Advanced Software EngineeringFebruary 2006 Testing - Techniques CSE300 Advanced Software Engineering.
Chapter 17 Software Testing Techniques
Software Testing Techniques. December Introduction Many aspects to achieving software quality –Formal reviews (of both the software process and.
1 “White box” or “glass box” tests “White Box” (or “Glass Box”) Tests.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
BASIS PATH TESTING ● By Tom McCabe ● McCabe, T., "A Software Complexity Measure," IEEE Trans. Software Engineering, vol. SE-2, December 1976, pp
Testing an individual module
Chapter 18 Testing Conventional Applications
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Software Engineering Lecture 12 Software Testing Techniques 1.
1 Software Testing Techniques CIS 375 Bruce R. Maxim UM-Dearborn.
Chapter 13 & 14 Software Testing Strategies and Techniques
Cyclomatic Complexity Dan Fleck Fall 2009 Dan Fleck Fall 2009.
Software Systems Verification and Validation Laboratory Assignment 3
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Software Testing Techniques
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
1 Chapter 6 Software Testing Techniques. 2 Testability Operability—it operates cleanly Operability—it operates cleanly Observability—the results of each.
INTRUDUCTION TO SOFTWARE TESTING TECHNIQUES BY PRADEEP I.
White-box Testing.
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 14a: Software Testing Techniques Software Engineering: A Practitioner’s Approach, 6/e Chapter.
Software Testing and Reliability Southern Methodist University CSE 7314.
These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 6/e (McGraw-Hill 2005). Slides copyright 2005 by Roger Pressman.1.
These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill 2009). Slides copyright 2009 by Roger Pressman.1.
White Box Testing Arun Lakhotia University of Southwestern Louisiana P.O. Box Lafayette, LA 70504, USA
Theory and Practice of Software Testing
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Dynamic Testing.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
White Box Testing by : Andika Bayu H.
These slides are designed to accompany Software Engineering: A Practitioner’s Approach, 7/e (McGraw-Hill 2009). Slides copyright 2009 by Roger Pressman.1.
Chapter 23 전통적인 애플리케이션 테스팅 Testing Conventional Applications 임현승 강원대학교 Revised from the slides by Roger S. Pressman and Bruce R. Maxim for the book “Software.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Software Testing Techniques Presented By Dr. Shazzad Hosain.
1 Lecture 14: Chapter 18 Testing Conventional Applications Slide Set to accompany Software Engineering: A Practitioner’s Approach, 7/e by Roger S. Pressman.
CSC 395 – Software Engineering Lecture 27: White-Box Testing.
Software Testing Testing is the process of exercising a program with the specific intent of finding errors prior to delivery to the end user.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Software Testing. SE, Testing, Hans van Vliet, © Nasty question  Suppose you are being asked to lead the team to test the software that controls.
Software Engineering (CSI 321)
Chapter 17 Software Testing Techniques
Chapter 18 Testing Conventional Applications
Software Testing.
White-Box Testing Pfleeger, S. Software Engineering Theory and Practice 2nd Edition. Prentice Hall, Ghezzi, C. et al., Fundamentals of Software Engineering.
Software Engineering (CSI 321)
Chapter 18 Testing Conventional Applications
Chapter 13 & 14 Software Testing Strategies and Techniques
Structural testing, Path Testing
White Box Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Chapter 18 Testing Conventional Applications
Chapter 18 Testing Conventional Applications
Chapter 14 Software Testing Techniques
“White box” or “glass box” tests
Chapter 18 Testing Conventional Applications
Chapter 18 Testing Conventional Applications.
Chapter 23 Testing Conventional Applications
Software Testing Techniques
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Chapter 13 & 14 Software Testing Strategies and Techniques 1 Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Unit III – Chapter 3 Path Testing.
Presentation transcript:

White-Box Testing Based on Pressman Ch 17 (5th edition) or Ch 14 (6th edition)

Agenda Introduction Overview of White-box testing Basis path testing Control structure testing Ref. Video: http://www.youtube.com/watch?v=wLINA-Gj7eA http://www.youtube.com/watch?v=FXZ5Mxgxg8k&feature=related http://www.youtube.com/watch?v=RhlzjrGgrGU&feature=related

Internal and External Views Any engineered product (and most other things) can be tested in one of two ways: Knowing the specified function that a product has been designed to perform, tests can be conducted that demonstrate each function is fully operational while at the same time searching for errors in each function; Knowing the internal workings of a product, tests can be conducted to ensure that "all gears mesh," that is, internal operations are performed according to specifications and all internal components have been adequately exercised.

Test Case Design "Bugs lurk in corners and congregate at boundaries ..." Boris Beizer OBJECTIVE to uncover errors CRITERIA in a complete manner CONSTRAINT with a minimum of effort and time

What is a ‘Good’ Test? A good test has a high probability of finding an error. A good test is not redundant. A good test should be “best of breed”. A good test should be neither too simple nor too complex.

Exhaustive Testing Executing a program with all possible combinations of inputs or values for program variables Computer Dictionary Online http://www.computer-dictionary-online.org/exhaustive%20testing.htm?q=exhaustive%20testing

Exhaustive Testing There are 10 possible paths! If we execute one loop < 20 X 14 There are 10 possible paths! If we execute one test per millisecond, it would take 3,170 years to test this program!!

Selective Testing Selected path loop < 20 X

White-Box Testing our goal is to ensure that all statements and conditions have been executed at least once ...

White-Box Testing (cont.) It is a test case design approach that uses the control structure (described as part of procedural design) to DERIVE test cases. We can derive test cases that: Guarantee that all independent paths within a module have been exercised/covered at least once. Exercise all logical decisions on their true and false sides. Execute all loops at their boundaries and within their operational bounds. Exercise internal data structures to ensure their validity.

Why Cover? Logic errors and incorrect assumptions are inversely proportional to a path's execution probability. We often believe that a path is not likely to be executed; in fact, the reality is often counter intuitive. Typographical errors are random; it's likely that untested paths will contain some.

Cyclomatic Complexity A measure of the number of linearly independent paths through a program module Cyclomatic Complexity is a measure for the complexity of code related to the number of ways there are to traverse a piece of code. This determines the minimum number of inputs you need to test all ways to execute the program. A software metric that provides a quantitative measure of the logical complexity of a program.

Cyclomatic Complexity A number of industry studies have indicated that the higher V(G), the higher the probability of errors. modules V(G) modules in this range are more error prone

Basis Path Testing It is one of the main ‘white-box’ testing techniques. It enables the test case designer to derive a logical complexity measure of a procedural design and use this measure as a guide for defining a basis set of execution paths. Test cases derived to exercise the basis set are guaranteed to execute every statement in the program at least one time during testing.

Basis Path Testing - Steps Using the design or code as a foundation, draw a corresponding control flow graph. Determine the cyclomatic complexity of the graph. Determine a basis set of linearly independent paths. Prepare test cases that will force execution of each path in the basis set.

Basis Path Testing – e.g. First, we compute the cyclomatic complexity: the number of simple decisions + 1 or the number of enclosed areas + 1 In this case, V(G) = 4

Basis Path Testing e.g. Next, we derive the independent paths: 1 Since V(G) = 4, there are four paths 2 Path 1: 1,2,3,6,7,8 3 4 Path 2: 1,2,3,5,7,8 5 6 Path 3: 1,2,4,7,8 Path 4: 1,2,4,7,2,4,...7,8 7 Finally, we derive test cases to exercise these 8 paths.

Basis Path Testing - Notes You don't need a flow chart, but the picture will help when you trace program paths. Count each simple logical test, compound tests count as 2 or more. Basis path testing should be applied to critical modules.

Flow Graph Notation Flow Graph or Program Graph The representation of control flow Depicts logical control flow.

Flow Graph Notation (cont.)

Flowchart and Flow Graph

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 a flow graph. Each row and column corresponds to an identified node, and matrix entries correspond to connections (an edge) between nodes. By adding a link weight to each matrix entry, the graph matrix can become a powerful tool for evaluating program control structure during testing.

Graph Matrices – e.g.

Control Structure Testing The basis path testing is simple and effective, but it is not sufficient in itself. Control structure testing techniques broaden testing coverage and improve quality of white-box testing.

Control Structure Testing Basis path testing Condition testing — exercises the logical conditions contained in a program module. Data flow testing — selects test paths of a program according to the locations of definitions and uses of variables in the program. Loop testing — focuses exclusively on the validity of loop constructs.

Condition Testing – e.g. A simple/basic condition is a Boolean variable or a relational expression (e.g. m>n, x+5<= 2*y, etc) A compound (or multiple) condition is composed of two or more simple conditions, Boolean operators, and parentheses. For example m>n AND x+5<=2*y, m>n OR x+5<=2*y, etc.

Multiple Conditions - 1 1 2 S2 S1 F T F T If (A > 5) and (B < 10) then S1 else S2; 1 F T F Conditions: 1 A > 5 2 B < 10 2 T S2 S1

Multiple Conditions - 2 1 2 S1 S2 T F T F If (A > 5) or (B < 10) then S1 else S2; F T 2 Conditions: 1 A > 5 2 B < 10 F S1 S2

Loop Testing Simple loop Nested Loops Concatenated Loops Unstructured

Loop Testing: Simple Loops Minimum conditions—Simple Loops 1. skip the loop entirely 2. only one pass through the loop 3. two passes through the loop 4. m passes through the loop m < n 5. (n-1), n, and (n+1) passes through the loop where n is the maximum number of allowable passes

Loop Testing: Nested Loops Start at the innermost loop. Set all outer loops to their minimum iteration parameter values. Test the min+1, typical, max-1 and max for the innermost loop, while holding the outer loops at their minimum values. Move out one loop and set it up as in step 2, holding all other loops at typical values. Continue this step until the outermost loop has been tested. If the loops are independent of one another then treat each as a simple loop else* treat as nested loops endif* for example, the final loop counter value of loop 1 is used to initialize loop 2. Nested Loops Concatenated Loops

Summary Overview of White-box testing Basis path testing Other control structure testing