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

    Homework 2:

         

        

    Questions:


    Identify the fault.

     If possible, identify a test case that does not execute the fault. (Reachability) 

     If possible, identify a test case that executes the fault, but does not result in an error state.

     If possible identify a test case that results in an error, but not a failure.

     

    Answer:

    左边程序的第六行改为:for (int i=x.length-1; i >= 0; i--)

       右边程序的第五行改为:for (int i=x.length-1; i >= 0; i--)

    左边程序:All inputs execute the fault - even the null input. 

       右边程序:All inputs execute the fault - even the null input. 

    左边程序 :如果不执行循环,那么就不会出现error,所以输入为空或者只含有一个元素。

                         input:x = [3]; y = 2

                         Expected Output: -1

                         Actual Output: -1

       右边程序 :如果不执行循环,那么就不会出现error; 如果循环只执行一次,那么从左到右和从右到左遍历的结果是一样的,也不会出现error。

                         input:x = [2]

                         Expected Output: -1

                         Actual Output: -1

    左边程序测试实例:当输入超过一个元素时,便会出现error;当期望值与实际值相等时,便不会出现failure。

                         input: x = [3,2,5] ; y = 2

                         Expected Output: 1

                         Actual Output: 1

       右边程序测试实例:当输入超过一个元素时,便会出现error;当期望值与实际值相等时,便不会出现failure。

                         input:x = [5,2,0]

                         Expected Output: 2

                         Actual Output: 2

  • 相关阅读:
    8.Http的状态码有哪些
    6、<!DOCTYPE>声明是什么意思
    6.px和em的区别
    5、什么叫优雅降级和渐进增强
    3、简述src和href的区别;@import和link的区别
    2、行内元素有哪些?块级元素有哪些? 空(void)元素有那些?行内元素和块级元素有什么区别?
    1、盒模型理解
    requests学习(一)——get请求
    【Flutter】功能型组件之跨组件状态共享
    【Flutter】功能型组件之数据共享
  • 原文地址:https://www.cnblogs.com/meiqin970126/p/8550620.html
Copyright © 2011-2022 走看看