博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Whats my Coverage? (C0 C1 C2 C3 + Path)
阅读量:4005 次
发布时间:2019-05-24

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

本文转载至: 

100% coverage sounds great, but is it c0, c1, c2, c3 or path coverage ? If you do not know, here is the answer:

  • C0 = every instruction
  • C1 = every branch if(i=1) a; even if there is no actual instruction in the i!=1 path it needs 2 tests
    1. i = 1
    2. i != 1
  • C2 + C3 ~= is every condition inside an ‘if’ is once true and once false (personally, i could not care less…)
  • C4: Path-coverage = every possible path was taken, if(a) x else b; if(c) y requires 4 tests
    1. a true c true
    2. a true c false
    3. a false c true
    4. a false c false

Try to aim for ~95% C0 and ~70% C1. C2 and C3 in my opinion add no value(except that they cover more paths) and C4 is often not possible, since a loop can have infinite paths (go through 1,2,3,4… times).

你可能感兴趣的文章
Android中AsyncTask的简单用法
查看>>
S3C6410启动模式介绍
查看>>
Jlink + ADS调试 S3C2440
查看>>
2440初始化存储器原理(接上一篇)
查看>>
S3C2440 USB 设备控制器(转)
查看>>
Linux usb 设备驱动 (1)
查看>>
解决跨网场景下,CAS重定向无法登录的问题(无需修改现有代码)
查看>>
java反编译命令
查看>>
activemq依赖包获取
查看>>
概念区别
查看>>
关于静态块、静态属性、构造块、构造方法的执行顺序
查看>>
final 的作用
查看>>
在Idea中使用Eclipse编译器
查看>>
idea讲web项目部署到tomcat,热部署
查看>>
优化IDEA启动速度,快了好多。后面有什么优化点,会继续往里面添加
查看>>
JMeter 保持sessionId
查看>>
IDEA Properties中文unicode转码问题
查看>>
Idea下安装Lombok插件
查看>>
zookeeper
查看>>
Idea导入的工程看不到src等代码
查看>>