1 / 20

# 软件测试技术与质量保证 - PowerPoint PPT Presentation

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about '软件测试技术与质量保证' - gamba

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### 软件测试技术与质量保证

1.5 白盒测试用例设计

s

t

(y > 1) and (z = 0)

x = x / y

c

a

f

t

(y = 2) or (x > 1)

x = x + 1

e

b

f

d

void example(int y, int z, int x) {

if (y > 1 && z == 0) x = x / y;

if (y == 2 || x > 1) x = x + 1;

}

s

t

(y > 1) and (z = 0)

x = x / y

c

a

f

t

(y = 2) or (x > 1)

x = x + 1

e

b

f

d

1.语句覆盖

s

t

(y > 1) and (z = 0)

x = x / y

c

a

f

t

(y = 2) or (x > 1)

x = x + 1

e

b

f

d

2.判定覆盖

(1)x = 3, y = 3, z = 0

(判定a为真,判定b为假)

(2) x = 1, y = 2, z = 1

(判定a为假,判定b为真)

s

t

(y > 1) and (z = 0)

x = x / y

c

a

f

t

(y = 2) or (x > 1)

x = x + 1

e

b

f

d

3.条件覆盖

(1)判定a的各种条件的所有可能结果为：

y>1, y≤1, z=0, z≠0

(2)判定b各种条件的所有可能结果为：

y=2, y≠2, x>1, x≤1

(1) x = 1, y = 2, z = 0

(执行路径sacbed，满足y>1,z=0,y=2, x≤1)

(2) x = 2, y = 1, z = 1

(执行路径sabed,满足y≤1,z≠0,y≠2 ,x>1)

s

t

(y > 1) and (z = 0)

x = x / y

c

a

f

t

(y = 2) or (x > 1)

x = x + 1

e

b

f

d

4.判定/条件覆盖

(1) x = 4, y = 2, z = 0

(执行路径sacbed，满足y>1,z=0,y=2, x>1,判定a为真,判定b为真)

(2) x = 1, y = 1, z = 1

(执行路径sabd,满足y≤1,z≠0,y≠2 ,x≤1,判定a为假,判定b为假)

s

t

(y > 1) and (z = 0)

x = x / y

c

a

f

t

(y = 2) or (x > 1)

x = x + 1

e

b

f

d

5.条件组合覆盖

(1) y>1, z=0 (2)y>1,z≠0

(3) y≤1,z=0 (4)y≤1,z≠0

(5) y=2,x>1 (6) y=2,x≤1

(7) y≠2,x>1 (8)y≠2,x≤1

x=4, y=2, z=0,执行sacbed,覆盖(1)(5)

x=1, y=2, z=1,执行sabed, 覆盖(2)(6)

x=2, y=1, z=0,执行sabed, 覆盖(3)(7)

x=1, y=1, z=1,执行sabd, 覆盖(4)(8)

s

t

(y > 1) and (z = 0)

x = x / y

c

a

f

t

(y = 2) or (x > 1)

x = x + 1

e

b

f

d

6.路径覆盖

(1)x=4, y=2, z=0, 执行sacbed

(2)x=3, y=3, z=0, 执行sacbd

(3)x=2, y=1, z=0, 执行sabed

(4)x=1, y=1, z=1, 执行sabd