zoukankan      html  css  js  c++  java
  • 2016 Tianjin University Software Testing (homework2)

    Question one:Identify the fault.
    the answer:
    the first function :The for-loop misses the 0 index,so that should be -- for(int i=x.length-1;i>=0;i--)
    the second function: The for-loop is from beginning to the end ,but we want to find the last 0. So that should be -- for(int i=x.length-1;i>=0;i--)

    Question two:If possible, identify a test case that does not execute the fault. (Reachability)
    The answer:
    the first function:x==null will throw a NullPointerException and it doesn't enter the for-loop test ,so there is no fault to execute. Just like this: Input: x=null;y=0 Expected:NullPointerException The real output: NullPointerException
    the second function:there is not such a case.

    Question three:If possible, identify a test case that executes the fault, but does not result in an error state.
    The answer:
    the first function: the y doesn't appear in the first position,there is no error. Just like this: Input: x=[0,2,0];y= 2; Expected:1 The real output: 1
    the second function: if the for-loop just executes once, that should be ok. Because the first become the last. Just like this: Input: x=[0] Expected:1 The real output: 1

    Question four:If possible identify a test case that results in an error, but not a failure.
    The answer:
    the first function: the y doesn't appear in the x array. Just like this: Input: x=[0,2,0];y= 3; Expected:-1 The real output: -1
    the second function: if the for-loop just executes more than once and the 0 appears only once, that should be ok. Just like this: Input: x=[1,0,2] Expected:1 The real output: 1

  • 相关阅读:
    CF850A Five Dimensional Points 题解
    AT3963 [AGC024F] Simple Subsequence Problem 题解
    jquery事件绑定机制
    前端初级词汇
    一个checkbox细节处理方式(checkbox与后面的文字对其)
    转 CSS hack:针对IE6,IE7,firefox显示不同效果
    想到的几点页面规范
    jQuery UI Dialog:Demo2:实用技巧
    zindex
    递归示例
  • 原文地址:https://www.cnblogs.com/ida-xj/p/5264811.html
Copyright © 2011-2022 走看看