软件测试作业 - fault error failure
Posted 事不过三寻
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了软件测试作业 - fault error failure相关的知识,希望对你有一定的参考价值。
给出的题目如下:
我的解答如下:
For program 1:
1.
where i > 0 is the fault , it should be changed to i>= 0 to avoid x is just one element situation.
2.x[] ={} or x[]={n}(n is equal to any numb),for example x[] ={1};
//test: x[] = {};y =2
//expected = NullPointerException; output = NullPointerException
3.
//test:x[] ={3 2 5} ; y = 2
//expected = 1; output = 1
4.
//test:x[] ={3} ; y = 2
//expected = -1; output = -1
For program 2:
1.
where the for loop is to get the first ZERO in array, it should be changed to
for(int i = x.length -1; i >= 0; i --)
2.
it is impossible, cause it doesn\'t belong to the fault. Its code is to get the First ZERO NOT LAST
3.
//test:x=[2 1 0]
//expect = 2; output = 2
4.
//test:x=[0 1 2]
//expect = 0 ; output = 0
以上是关于软件测试作业 - fault error failure的主要内容,如果未能解决你的问题,请参考以下文章
软件测试作业2 — 软件测试中的错误Failure, Error, Fault的区别
软件测试作业2:fault,error,failure 的区别
RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend"