当前位置:首页计算机类软件水平考试中级软件评测师->逻辑覆盖法是设计白盒测试用例的主要方法之一,它是通过对程序逻

逻辑覆盖法是设计白盒测试用例的主要方法之一,它是通过对程序逻辑结构的遍历实现程序的覆盖。针对以下由C语言编写的程序,按要求回答问题。 getit( int m) { int i, k; k=sqrt(m); for ( i=2; iimage.png=k; i++) if (m % i=0) break; if ( i>=k+1 ) printf( "%d is a selected number\n", m); else printf( "%d is not a selected number\n", m ); }1、请找出程序中所有的逻辑判断子语句。2、请将满足100%DC(判定覆盖)所需的逻辑条件填入下表。

中级软件评测师,章节练习,测试用例设计方法

3、请画出上述程序的控制流图,并计算其控制流图的环路复杂度VG.。假设函数getit的参数m取值范围是150image.pngmimage.png160,请使用基本路径测试法设计测试用例,将参数m的取值填入下表,使之满足基本路径覆盖要求。

中级软件评测师,章节练习,测试用例设计方法

查看答案 纠错
答案:
本题解析:

1、本题考查对编程语言的理解,着重考查判断语句。程序中的逻辑判断子语句如下:i<=k m%i==0i>=k+111、

本题考查白盒测试用例设计方法:判定覆盖法。判定覆盖法又称为逻辑覆盖,是通过对程序逻辑结构的遍历实现程序的覆盖。

中级软件评测师,章节练习,测试用例设计方法

2、本题考查白盒测试用例设计方法:基本路径法。涉及的知识点包括:根据代码绘制程序流图、计算环路复杂度以及设计测试用例。注意测试用例的数目本应和环路复杂度是一致的,但存在特殊情况。控制流图:

中级软件评测师,章节练习,测试用例设计方法

3、环路复杂度:V(G)=4 基本路径覆盖用例:

中级软件评测师,章节练习,测试用例设计方法

更新时间:2021-12-12 02:26

你可能感兴趣的试题

单选题

(  )is the process of transforming information so it is unintelligible to anyone but the intended recipient.

  • A.Encryption
  • B.Decryption
  • C.Security
  • D.Protection
查看答案
单选题

As each application module is completed,it undergoes(  )to ensure that it operates correctly and reliably.

  • A.unit testing
  • B.integration testing
  • C.system testing
  • D.acceptance testing
查看答案
单选题

(  )algorithm specifies the way to arrange data in a particular order.

  • A.Search
  • B.Random
  • C.Sorting
  • D.Merge
查看答案
单选题

After analyzing the source code,(  )generates machine instructions that will carry out the meaning of the program at a later time.

  • A.an interpreter
  • B.a linker
  • C.a compiler
  • D.a converter
查看答案
单选题

(  )can help organizations to better understand the information contained within the data and will also help identify the data that is most important to the business and future business decisions.

  • A.Data processing system
  • B.Big Data analytics
  • C.Cloud computing
  • D.Database management
查看答案
单选题

浏览器开启无痕浏览模式后,(  )依然会被保存下来。

  • A.浏览历史
  • B.搜索历史
  • C.已下载文件
  • D.临时文件
查看答案
单选题

下列协议中,不属于TCP/IP协议簇的是(  )。

  • A.CSMA/CD
  • B.IP
  • C.TCP
  • D.UDP
查看答案
单选题

下列传输介质中,带宽最宽、抗干扰能力最强的是(  )。

  • A.双绞线
  • B.红外线
  • C.同轴电缆
  • D.光纤
查看答案
单选题

数控编程常需要用参数来描述需要加工的零件的图形。在平面坐标系内,确定一个点需要2个独立的参数,确定一个正方形需要(  )个独立的参数。

  • A.3
  • B.4
  • C.5
  • D.6
查看答案
单选题

某书的页码为1,2,3,...,共用数字900个(一个多位数页码包含多个数字),据此可以推断,该书最大的页码为(  )。

  • A.237
  • B.336
  • C.711
  • D.900
查看答案