White-Box Testing Eshcar Hillel Michael Beder. White Box Testing 2 Tutorial Outline What is White Box Testing? Flow Graph and Coverage Types Symbolic.

Slides:



Advertisements
Similar presentations
Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
Advertisements

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
Chapter 6 Path Testing Software Testing
Whitebox Testing Fra: CS Fall Whitebox Testing AKA Structural, Basis Path Test Normally used at unit level Assumes errors at unit level are.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Graph Coverage (2).
1 Static Analysis Methods CSSE 376 Software Quality Assurance Rose-Hulman Institute of Technology March 20, 2007.
White Box Testing and Symbolic Execution Written by Michael Beder.
White Box Testing and Symbolic Execution Written by Michael Beder.
1 “White box” or “glass box” tests “White Box” (or “Glass Box”) Tests.
White Box Testing Techniques Dynamic Testing. White box testing(1) Source code is known and used for test design While executing the test cases, the internal.
White Box Testing and Symbolic Execution Written by Michael Beder.
IMSE Week 18 White Box or Structural Testing Reading:Sommerville (4th edition) ch 22 orPressman (4th edition) ch 16.
Testing an individual module
Unit Testing CS 414 – Software Engineering I Don Bagert Rose-Hulman Institute of Technology January 16, 2003.
SOFTWARE TESTING WHITE BOX TESTING 1. GLASS BOX/WHITE BOX TESTING 2.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
Software Systems Verification and Validation Laboratory Assignment 3
CMSC 345 Fall 2000 Unit Testing. The testing process.
Testing phases. Test data Inputs which have been devised to test the system Test cases Inputs to test the system and the predicted outputs from these.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 20 Slide 1 Defect testing l Testing programs to establish the presence of system defects.
Chapter 13: Implementation Phase 13.3 Good Programming Practice 13.6 Module Test Case Selection 13.7 Black-Box Module-Testing Techniques 13.8 Glass-Box.
Overview of Software Testing 07/12/2013 WISTPC 2013 Peter Clarke.
White-Box Testing Techniques II Originals prepared by Stephen M. Thebaut, Ph.D. University of Florida Dataflow Testing.
Agenda Introduction Overview of White-box testing Basis path testing
1 Software Testing. 2 Path Testing 3 Structural Testing Also known as glass box, structural, clear box and white box testing. A software testing technique.
Testing Testing Techniques to Design Tests. Testing:Example Problem: Find a mode and its frequency given an ordered list (array) of with one or more integer.
Test Coverage CS-300 Fall 2005 Supreeth Venkataraman.
INTRUDUCTION TO SOFTWARE TESTING TECHNIQUES BY PRADEEP I.
White-box Testing.
Software Testing and Reliability Southern Methodist University CSE 7314.
1 Program Testing (Lecture 14) Prof. R. Mall Dept. of CSE, IIT, Kharagpur.
BASIS PATH TESTING.
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.
Agent program is the one part(class)of Othello program. How many test cases do you have to test? Reversi [Othello]
White Box Testing by : Andika Bayu H.
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
White-Box Testing Statement coverage Branch coverage Path coverage
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
CS223: Software Engineering Lecture 26: Software Testing.
1 Software Testing. 2 What is Software Testing ? Testing is a verification and validation activity that is performed by executing program code.
White Box Testing. Agenda White-box vs Black-box Program Flow Controls White-box Test Methods Exercises Complexity Q&A.
BASIS PATH TESTING.
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 Testing.
Control Flow Testing Handouts
Handouts Software Testing and Quality Assurance Theory and Practice Chapter 4 Control Flow Testing
Software Engineering (CSI 321)
Software Testing and Maintenance 1
Outline of the Chapter Basic Idea Outline of Control Flow Testing
Structural testing, Path Testing
WHITEBOX TESTING APPROACH
Types of Testing Visit to more Learning Resources.
White Box Testing.
White-Box Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing (Lecture 11-a)
“White box” or “glass box” tests
Solution to problem 4. a) Control flow graph art Start k = i + 2 * j
White-Box Testing Techniques II
Whitebox Testing.
HW2: A prime path generator (Due Oct 6th 23:59)
White-Box Testing.
Whitebox Testing.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Software Testing.
Unit III – Chapter 3 Path Testing.
Presentation transcript:

White-Box Testing Eshcar Hillel Michael Beder

White Box Testing 2 Tutorial Outline What is White Box Testing? Flow Graph and Coverage Types Symbolic Execution: – Formal Definition – Examples

White Box Testing 3 White-Box means Testing by Implementation Execution-based testing that uses the program’s inner structure and logical properties – A.K.A Clear Box, Glass Box and Structural Testing There are different types of white-box testing – For example statement coverage where each statement is executed at least once Flow Graph helps us model an analyze different types of coverage

White Box Testing 4 Flow Graph G = (V, E) where - V is the set of basic blocks - E is the set of control branches Example: 1. a = Read(b) 2. c = 0 3. while (a > 1) 4. If (a^2 > c) 5. c = c + a 6. a = a - 2 1, 2345endstart T T 6 F F Input: b = 2 Output: a = 0, c = 2

White Box Testing 5 White Box Coverage Types Statement Coverage: Every statement is executed Branch Coverage: Every branch option is chosen Path Coverage: Every path is executed Basic Path Coverage: – We need to define basic path set first Loops?

White Box Testing 6 Basic Path Set An execution path is a set of nodes and directed edges in a flow graph that connects (in a directed fashion) the start node to a terminal node. Two execution paths are said to be independent if they do not include the same set of nodes and edges. A basic set of execution paths for a flow graph is an independent maximum set of paths in which all nodes and edges of the graph are included at least once.

White Box Testing 7 Basic Path Coverage The number of Basic paths is E – N + 2 (Linear Complexity) Example p1 = start – 1,2 – 3 – end p2 = start – 1,2 – 3 – 4 – 6 – 3 – end p3 = start – 1,2 – 3 – 4 – 5 – 6 – 3 – end E – N + 2 = 8 – = 3 1, 2345endstart T T 6 F F

White Box Testing 8 Path Function A function represents the current values of the variables as function of their initial values Each variable X is represented by a projection function Function composition – For example

White Box Testing 9 Path Condition A condition that ensures the execution of a path A constraint on the initial values of the variables For Example: p = start – 1,2 – 3 – end. 1. a = Read(b) 2. c = 0 3. while (a > 1) 4. if (a^2 > c) 5. c = c + a 6. a = a – 2 The path condition is B <= 1, where B is the initial value of b 1, end start T T 6 F F

White Box Testing 10 Symbolic Execution A method for deriving test cases which satisfy a given path – Outputs path condition (input) and path function (expected result) Initially – Path function is the Identity function – Path condition is true Each step in the path induce a symbolic composition on the path function or a logical constraint on the path condition – Simple block g(x): – Control branch:CC branch condition

White Box Testing 11 Example: Symbolic Execution 1. a = Read(b) 2. c = 0 3. while (a > 1) 4. if (a^2 > c) 5. c = c + a 6. a = a – 2 Find test case for path: p = start – 1,2 – 3 – 4 – 5 – 6 – 3 – 4 – 5 – 6 – 3 – end 1, end start T T 6 F F

White Box Testing a = Read(b) 2. c = 0 3. while (a > 1) 4. if (a^2 > c) 5. c = c + a 6. a = a – 2 p = start – 1,2 – 3 – 4 – 5 – 6 – 3 – 4 – 5 – 6 – 3 – end vertexpath functionpath condition start: (A, B, C) true 1,2 (A, B, C) true 3 (B, B, 0) true 4 (B, B, 0) (true Λ B>1) ↔ B>1 5 (B, B, 0) (B>1 Λ B^2>0) ↔ B>1 1, 2345endstart T T 6 F F Example: Symbolic Execution

White Box Testing a = Read(b) 2. c = 0 3. while (a > 1) 4. if (a^2 > c) 5. c = c + a 6. a = a – 2 p = start – 1,2 – 3 – 4 – 5 – 6 – 3 – 4 – 5 – 6 – 3 – end vertex path function path condition 6(B, B, B) B>1 3(B-2, B, B) B>1 4(B-2, B, B)(B>1 Λ B-2>1) ↔ B>3 5(B-2, B, B) (B>3 Λ (B-2)^2>B) ↔ B>4 6(B-2, B, 2B-2) B>4 3(B-4, B, 2B-2) B>4 end (B-4, B, 2B-2) (B>4 Λ B-4<=1) ↔ B=5 1, 2345endstart T T 6 F F Example: Symbolic Execution

White Box Testing a = Read(b) 2. c = 0 3. while (a > 1) 4. if (a^2 > c) 5. c = c + a 6. a = a – 2 p = start – 1,2 – 3 – 4 – 5 – 6 – 3 – 4 – 5 – 6 – 3 – end end (B-4, B, 2B-2) B=5 Hence the test case is B = 5 and the expected result is 2B-2 = 8 1, end start T T 6 F F Is there a test case for p = start – 1,2 – 3 – 4 – 5 – 6 – 3 – 4 – 5 – 6 – 3 – 4 – 5 – 6 – 3 – end ? Example: Symbolic Execution