This action might not be possible to undo. Are you sure you want to continue?

BooksAudiobooksComicsSheet Music### Categories

### Categories

Scribd Selects Books

Hand-picked favorites from

our editors

our editors

Scribd Selects Audiobooks

Hand-picked favorites from

our editors

our editors

Scribd Selects Comics

Hand-picked favorites from

our editors

our editors

Scribd Selects Sheet Music

Hand-picked favorites from

our editors

our editors

Top Books

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Audiobooks

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Comics

What's trending, bestsellers,

award-winners & more

award-winners & more

Top Sheet Music

What's trending, bestsellers,

award-winners & more

award-winners & more

P. 1

12 White-Box Testing Fixed|Views: 4|Likes: 0

Published by Auxilia Richard

this is an article on white box testing

this is an article on white box testing

See more

See less

https://www.scribd.com/doc/138109456/12-White-Box-Testing-Fixed

08/10/2015

text

original

Eshcar Hillel Michael Beder

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

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

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

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: Loops? – We need to define basic path set first 5 White Box Testing .

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. 6 White Box Testing .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.

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

Z ). Y . Z ) = X + Y fY ( X .Path Function A function f : D n → D n represents the current values of the variables as function of their initial values Each variable X is represented by a projection function f X : D n → D Function composition ( g o f )(v ) = g ( f X (v ). XZ ) = (( X + Y )( X − Y ).( X + Y ) + XZ . Y . X − Y .. f Z ( X . XZ ) f X ( X . XZ ) 8 White Box Testing .Y . Y . f X (v )) – For example 1 n f ( X . Z ) = ( X + Y . fY ( X . Z ) = X − Y f Z ( X . Z ) = ( XY . Z ) = g ( f X ( X . Y . Y . Z )) = = g ( X + Y . X − Y ... Z ). Z ) = XZ g ( X . Y . Z ) ( g o f )( X .. Y . Y . X + Z .

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

Symbolic Execution A method for deriving test cases which satisfy a given path – Outputs path condition (input) and path function (expected result) Path function is the Identity function Path condition is true Initially – – 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): f ← g o f Control branch: C ← C ∧ branch condition 10 White Box Testing .

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

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

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

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

Usharani Thendral Thee(Novel 125 Malu)

Achieving the Full Potential of Test Automation

[4] Morgan Kaufmann - Artificial Intelligence_ a New Synthesis- Nils J. Nilsson_ 513s_ ISBN 1558604677 - 1998

AINotes4

Case Study - Performance

Ontology-Based Access Control Policy Interoprability

Daytwo Keypm Erl

AICTE 2013-14 Faculty Details Format (1)

VaanamVasapadum

Unit 2 new

- Read and print without ads
- Download to keep your version
- Edit, email or read offline

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

CANCEL

OK

You've been reading!

NO, THANKS

OK

scribd