è½¯ä»¶æµ‹è¯•æŠ€æœ¯ä¸Žè´¨é‡ä¿è¯

1 / 20

è½¯ä»¶æµ‹è¯•æŠ€æœ¯ä¸Žè´¨é‡ä¿è¯ - PowerPoint PPT Presentation

è½¯ä»¶æµ‹è¯•æŠ€æœ¯ä¸Žè´¨é‡ä¿è¯. ä¸»è®²äººï¼šå¾ä¸½. 1.5 ç™½ç›’æµ‹è¯•ç”¨ä¾‹è®¾è®¡. ç™½ç›’æµ‹è¯•ä¹Ÿç§°ç»“æž„æµ‹è¯•ï¼ˆé€»è¾‘é©±åŠ¨æµ‹è¯•ã€åŸºäºŽç¨‹åºçš„æµ‹è¯•ï¼‰ï¼Œå®ƒæ˜¯çŸ¥é“äº§å“å†…éƒ¨å·¥ä½œè¿‡ç¨‹ï¼Œå¯é€šè¿‡æµ‹è¯•æ¥æ£€æµ‹äº§å“å†…éƒ¨åŠ¨ä½œæ˜¯å¦æŒ‰ç…§è§„æ ¼è¯´æ˜Žä¹¦çš„è§„å®šæ­£å¸¸è¿›è¡Œï¼Œæ˜¯é’ˆå¯¹æºç¨‹åºå®žçŽ°çš„æµ‹è¯•ã€‚. s. å…¥å£. t. (y &gt; 1) and (z = 0). x = x / y. c. a. f. t. (y = 2) or (x &gt; 1). x = x + 1. e. b. f. è¿”å›ž. d. void example(int y, int z, int x) {

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

PowerPoint Slideshow about 'è½¯ä»¶æµ‹è¯•æŠ€æœ¯ä¸Žè´¨é‡ä¿è¯' - gamba

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