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

  • 相关阅读:
    open_basedir restriction in effect的错误及其解决办法
    SNMP-网络管理协议
    安装cacti监控系统
    并发时-修改Linux系统下的最大文件描述符限制
    js new date()说明
    阿里云ECS环境部署 centos 6.5
    sysbench
    http_load
    LeetCode: Spiral Matrix
    LeetCode:Length of Last Word
  • 原文地址:https://www.cnblogs.com/ida-xj/p/5264811.html
Copyright © 2011-2022 走看看