软件测试第三次作业
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了软件测试第三次作业相关的知识,希望对你有一定的参考价值。
7:题目
Use the following method printPrimes() for questions a-d;
(a)为printPrimes()画控制流程图。
(b)考虑测试用例t1=(n=3)和t2=(n=5)。即使这些测试用例游历printPrimes()方法中相同的主路径,他们不一定找出相同的错误。设计一个简单的错误,使得t2比t1更容易发现。
答:将while(numPrimes<n)改成(while(numPrimes<4)使其越界。
(c)针对printPrimes(),找到一个测试用例,使用相同的测试路径访问连接while语句开始到for语句的边,而不能通过while循环体。
答:t3=(n=1);
(d)针对printPrimes()的图例举每个节点覆盖,边覆盖和主路径覆盖的测试需求。
答:
1:节点覆盖:TR={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
2:边覆盖:TR={(1,2),(2,3),(3,4),(4,5),(5,6),(6,7),(5,7),(7,4),(7,8),(8,9),(7,9),(9,2),(9,15),(2,10),(10,11),(10,12),(11,13),(12,14),(13,14),(14,15)}
,
3:主路径覆盖:TR={[4,5,7,4],[5,7,4,5],[7,4,5,7],[4,5,6,7,4],
[5,6,7,4,5],[7,4,5,6,7],[6,7,4,5,6],[2,3,4,5,6,7,8,9,2],[2,3,4,5,6,7,9,2],[2,3,4,5,7,8,9,2],[2,3,4,5,7,9,2],[3,4,5,6,7,8,9,2,3],[3,4,5,6,7,9,2,3],[3,4,5,7,8,9,2,3],[3,4,5,7,9,2,3],[4,5,6,7,8,9,2,3,4],[4,5,6,7,9,2,3,4],
[4,5,7,8,9,2,3,4],[4,5,7,9,2,3,4],[5,6,7,8,9,2,3,4,5],[5,7,8,9,2,3,4,5],[5,6,7,9,2,3,4,5],[5,7,9,2,3,4,5],[6,7,8,9,2,3,4,5,6],[6,7,9,2,3,4,5,6],
[7,8,9,2,3,4,5,6,7],[7,9,2,3,4,5,6,7],[7,8,9,2,3,4,5,7],[7,9,2,3,4,5,7],
[8,9,2,3,4,5,6,7,8],[8,9,2,3,4,5,7,8],[9,2,3,4,5,6,7,8,9],[9,2,3,4,5,7,8,9],[9,2,3,4,5,7,9],[9,2,3,4,5,7,9][1,2,3,4,5,6,7,8,9,15],
[1,2,3,4,5,7,8,9,15],[1,2,3,4,5,6,7,9,15],[1,2,3,4,5,7,9,15],
[1,2,10,11,12,14,15],
[1,2,10,11,13,14,15],
以上是关于软件测试第三次作业的主要内容,如果未能解决你的问题,请参考以下文章