zoukankan      html  css  js  c++  java
  • 软件测试:homework2

    题目:

    首先我们需要搞懂fault,error,failure的区别:

    百度搜索到的解释:

    Software Fault: A static defect in the software;(eg: virus)
    Software Failure: External, incorrect behavior with respect to the requirements or other description of the expected behavior;( eg: high body temperature)
    Software Error: An incorrect internal state that is the manifestation of some fault;(eg: some symptoms)

    我的理解是:

    Software Fault: 在编程中出错的那句话,或者是那个错误的方式
    Software Failure: 运行结果与预期的不一样就是导致了一个failure
    Software Error: 在测试用例运行中,运行了fault的错误方式,就导致了一个error

    Answer:

    In the first faulty programs:

    1、Actual output:-1. Because in the loop i can not get 0, we need to change it.

    for(int i=x.length-1;i>=0;i--)

     

    2、 test:x=[] ; y=1

    Array x is a null array, throw NullPointerException.

    3、 test:x=[0,1,2] ;y=1

    Expected=1

    Actual = 1

    Although it leads to fault, it doesn’t leads to error. Because when i=1, then return i.

    4、 test:x=[0,1,2] ;y=3

    Expected = -1

    Actual = -1

    Although it leads to error, the result is right.

     

    In the second faulty programs:

    1、Actual output:0 . Because in the first loop x[i]==0,output the i, we need to change it.

    for( int i = x.length-1 ; i >= 0 ; i++)

    2、test:x=[]

    Array x is a null array, throw NullPointerException.

    3、 test:x=[0]

    Expected=0

    Actual = 0

    Although it leads to fault ,it doesn’t leads to error. Because x.length=0;

    4、 test:x=[1,2,3]

    Expected=-1

    Actual = -1

    Although it leads to error but the result is right

     

     

  • 相关阅读:
    ASCII对照表
    Python学习记录-3-简明Python教程-数据结构
    Python学习记录-2
    Python新手容易遇到的问题
    python学习问题之-编码
    同步与异步的概念(转自http://blog.chinaunix.net/uid-21411227-id-1826898.html)
    Objective-c学习三
    挺有意思的人体时钟代码(转自http://ziren.org/tools/hone-hone-clock.html)
    int ,long , long long类型的范围
    css3选择器使用例子
  • 原文地址:https://www.cnblogs.com/mjm212/p/6442051.html
Copyright © 2011-2022 走看看