软件测试复习题及答案.doc
《软件测试复习题及答案.doc》由会员分享,可在线阅读,更多相关《软件测试复习题及答案.doc(5页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、复习题1.Below is one faulty program. It includes a test case that results in failure. Answer the following questions about the program.(20)(a) Identify the fault.(b) If possible, identify a test case that does not execute the fault.(c) If possible, identify a test case that executes the fault, but does
2、 not result in an error state.(d) If possible identify a test case that results in an error, but not a failure. Hint: Dont forget about the program counter.(e) For the given test case, identify the first error state. Be sure to describe the complete state.(f) Fix the fault and verify that the given
3、test now produces the expected output.(a) The for-loop should search high to low:for (int i=x.length-1; i = 0; i-) (b) All inputs execute the fault - even the null input.(c) If the loop is not executed at all, there is no error. If the loop is executed only once, high-to-low and low-to-high evaluati
4、on are the same. Hence there is no error for length 0 or length 1 inputs.Input: x = 3Expected Output: -1Actual Output: -1(d) There is an error anytime the loop is executed more than once, since the values of index i ascend instead of descend.Input: x = 1, 0, 3Expected Output: 1Actual Output: 1(e) Th
5、e first error state is when index i has the value 0 when it should have a value at the end of the array, namely x.length-1. Hence, the first error state is encountered immediately after the assignment to i in the for-statement if there is more than one value in x.Input: x = 0, 1, 0Expected Output: 2
6、Actual Output: 0First Error State:x = 0, 1, 0i = 0PC = just after i= 0;(f ) See (a)4. Answer questions (a)(d) for the graph defined by the following sets: N = 1, 2, 3, 4,N0 = 1,Nf = 4,E = (1, 2), (2, 3), (3, 2), (2, 4)(a) Draw the graph.(b) List test paths that achieve node coverage, but n
7、ot edge coverage.(c) List test paths that achieve edge coverage, but not edge Pair coverage.(d) List test paths that achieve edge pair coverage.(a)Omitted.(b) For this program, this is not possible. All test paths must begin at node 1, visit node 2, and, eventually, end at node 4. Any test path that
8、 visits node 3 also visits both edge (2; 3) and edge (3; 2).(c) T = 1; 2; 3; 2; 4Note that the edge pair 3; 2; 3 is not toured by the single test path given.(d) T = 1; 2; 4; 1; 2; 3; 2; 3; 2; 45. A graph is defined by the sets of nodes, initial nodes, final nodes, edges, and defs and uses. Each grap
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 软件 测试 复习题 答案
限制150内