博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【软件测试】Exercise Section 2.3 #7
阅读量:4500 次
发布时间:2019-06-08

本文共 852 字,大约阅读时间需要 2 分钟。

7. Use the following method printPrimes() for questions a–d.

–基于Junit及Eclemma(jacoco)实现一个主路径覆盖的测试。

 

solution:

a) control flow graph

b) test cases: t1 = (n = 3), t2 = ( n = 5).Design a simple fault that t2 would be more likely to discover than t1.

fault:

changed to :

  

 

c) test case that jump to the for loop from the start of 'while' without the while loop body

test case: n = 1

 

d)enumerate TR for NC, EC, PPC

NC: TR = {1,2,3,4,5,6,7,8,9,10,11,12,13}

EC: TR = {(1,2),(2,3),(2,10),(3,4),(4,5),(4,8),(5,6),(5,7),(7,4),(6,8),(8,9),(8,10),(9,10),(10,11),(11,12),(11,13),(12,11)}

PPC: TR = {[1,2,10,11,13], [1,2,3,4,5,7], [1,2,3,4,5,6,8,9,10,11,12], [1,2,3,4,5,6,8,9,10,11,13], [1,2,3,4,5,6,8,10,11,12], [1,2,3,4,5,6,8,10,11,13], [11,12,11], [12,11,12], [4,5,7,4], [5,7,4,5], [7,4,5,7]}

 

代码实现(截图):     

转载于:https://www.cnblogs.com/3013218071zjr/p/5326393.html

你可能感兴趣的文章
编程习惯1
查看>>
【读书笔记】iOS-给模拟器相册增加图片
查看>>
【Silverlight实例】Silverlight与Access数据库的互操作
查看>>
Java实现AES加密,异常java.security.InvalidKeyException: Illegal key size 的解决
查看>>
ActionMapping、ActionForward笔记
查看>>
带你入门机器学习
查看>>
fragment 重叠问题
查看>>
三层架构,四层模型
查看>>
[HAOI2008]硬币购物
查看>>
纯C语言跑分(详细注释)
查看>>
.Net分布式架构(一):Nginx实现负载均衡
查看>>
POJ 2485 Highways(最小生成树Prim算法)
查看>>
文本界面听歌神器--moc
查看>>
Ubuntu上安装谷歌第二代机器学习系统TensorFlow
查看>>
Linux:xargs命令详解
查看>>
Flex 布局教程:语法篇
查看>>
明天你好
查看>>
Spring 分散装配
查看>>
漫话爬取
查看>>
sublime js插件
查看>>