软件测试技术HW2

Program 1:
(1) Fault: ‘for(int i=x.length-1;i>0;i--)’. It should be “i>=0”.
(2) X=[],y=2.
  Expected=NullPointerException.
  Output=NullPointerException
(3) X=[2,3,5],y=3.
  Expected=1
  Output=1
(4) X=[1,3,5],y=2.
  Expected=-1
  Output=-1


Program 2:
(1) Fault: The for-loop should be:
  for(int i=x.length-1;i>=0;i--)
(2)It’s impossible.
(3) X=[]
  Expected=NullPointerException.
  Output=NullPointerException
(4)x=[0,1,2]
  Expected=0
  Output=0

Summery:

fault - a cause of the error (mistake in coding)
error - incorrect state that may lead to failure
failure - deviation of the service from the correct service

posted @ 2017-03-02 16:32  DiligentToHappy  阅读(129)  评论(0编辑  收藏  举报