蜂蜜什么时候喝比较好| 两个人一个且念什么| 怀孕会出现什么状况| 能够握紧的就别放了是什么歌| 九零年属什么生肖| 尿葡萄糖是什么意思| 烂嘴唇是什么原因引起的| 三百多分能上什么大学| vjc是什么品牌| 脊髓空洞症吃什么药| ce是什么意思| 1030是什么星座| 甲状腺有什么作用| 乳环是什么| 梦见掉粪坑里了是什么意思| 卟啉病是什么病| 淋巴结是什么病严重吗| 白噪音什么意思| 反流性食管炎吃什么食物好| 什么面好吃| 鼻炎流鼻血是什么原因| 细胞是什么| 什么白| 什么是签注| 胃寒吃什么食物好| 晚上睡觉流口水是什么原因| 耳朵突然听不见是什么原因| 卵巢囊肿是什么原因引起的| 双侧胸膜局限性增厚是什么意思| 肠胃胀气是什么原因| 热水器什么品牌好| 凝血功能差是什么原因| 祖马龙是什么档次| 阴阳双补用什么药最佳| geya是什么牌子的手表| 撕漫男什么意思| 哈戳戳是什么意思| 冉冉是什么意思| 正月初九是什么星座| 长期喝酒有什么危害| 低迷是什么意思| 黄桃什么时候成熟| 在什么什么前面| 紫苏有什么作用与功效| 急性胃炎吃什么药好| 什么植物好养又适合放在室内| 倒立对身体有什么好处| 肠痉挛吃什么药| 什么是同比| 什么什么迷人| 碱性磷酸酶是什么| 胃胀打嗝吃什么药最好| 刀郎和那英是什么关系| 总是拉稀是什么原因| 沙特是什么教派| spect是什么检查| 老虎属于什么科| 外阴白斑瘙痒抹什么药| 转铁蛋白阳性什么意思| 站着说话不腰疼什么意思| 梅毒是什么| 泥鳅吃什么东西| 梦见纸人是什么意思| 吃什么能增强免疫力和抵抗力| 梦见别人生孩子预示什么| cm是什么| 丝瓜有什么营养| 联姻是什么意思| 升阳是什么意思| 砚是什么意思| 小儿惊痫是什么症状| 肝郁是什么意思| 嘴馋是什么意思| 1948年是什么年| rot是什么意思| 七月14号是什么星座| 京五行属什么| 尿酸查什么| 摇曳是什么意思| 罗纹布是什么面料| 什么人不能吃人参| 1971年属猪的是什么命| 舌头胖大是什么原因| 一点半是什么时辰| 戍什么意思| 梦见鳄鱼是什么意思| 拉肚子为什么憋不住| 什么除湿气效果最好| 眩晕症是什么原因造成的| 5月9日是什么星座| 支气管炎有什么症状| 为什么会出汗| 欧舒丹属于什么档次| 栀子花什么时候修剪| 鼻涕粘稠是什么原因| 腮腺炎是什么原因引起的| 洪字五行属什么| 哦什么意思| 自言自语的近义词是什么| 1945属什么生肖| 搞破鞋是什么意思| 黄疸吃什么药| 冰箱什么牌子好| hbeag阳性是什么意思| 什么的木筏| 草字头的字和什么有关| 吃什么补孕酮最快| 胃热吃什么药最有效| 四月二十五是什么星座| 什么是中国舞| 鼻咽炎是什么症状| 八一是什么节| 葡萄代表什么生肖| 烧心吃什么药| 咲是什么意思| 右耳朵痒是什么预兆| 梦见自己掉牙是什么意思| 爱慕是什么意思| 前年是什么年| 左眼皮跳是什么预兆女| 水指什么生肖| 藿香正气水有什么功效| 梦见摘菜是什么意思| 酒后头疼吃什么药| 秦始皇陵为什么不敢挖| 什么是基因突变| 蚝油是干什么用的| 植物光合作用产生什么| 师长是什么军衔| 肺结节是什么病严重吗| c5是什么驾驶证| 十九朵玫瑰花代表什么意思| 虾吃什么| 月经来了不走是什么原因| 夹层是什么意思| 大肠杆菌是什么| 中暑吃什么水果| 为什么湿气重| 长期耳鸣是什么原因| 靖国神社是什么| 感冒头疼是什么原因| 先天性一个肾对人有什么影响| 男人屁股翘代表什么| vca是什么牌子| 秦始皇的名字叫什么| 手淫过度吃什么药| 头晕是什么原因引起| 刘邦和刘备什么关系| 子宫平位是什么意思| beast什么意思| 疖子是什么| 吃什么提高代谢| 什么动物捉害虫| 梭形是什么形状| 十万个为什么内容| 墨西哥用什么货币| 五月十四号是什么情人节| 白马怕青牛是什么意思| 夏天什么时候结束| 定心丸什么意思| 卵巢结节是什么意思| 备孕需要注意些什么| 凹儿念什么| 小腿肌肉抽筋是什么原因引起的| 急性化脓性扁桃体炎吃什么药| 11月23日是什么星座| 月经调理吃什么好| 低钾会出现什么症状| 检查喉咙挂什么科| 什么像什么| 梅花表属于什么档次| 红霉素软膏和眼膏有什么区别| 床榻是什么意思| 转氨酶高是什么原因造成的| 皮肤瘙痒用什么药治疗| crc是什么职业| 肾阴阳两虚用什么药| 什么是动车| 菲薄是什么意思| 有主见是什么意思| 不以为意什么意思| 6月11日是什么星座| 自相矛盾是什么意思| 0属于什么数| 夏末是什么时候| 什么叫打飞机| 路政是干什么的| 什么叫消融手术| 女人腰上有痣代表什么| 力不从心是什么意思| 人突然消瘦是什么原因| hpv是什么病严重吗| 弟弟的孩子叫姐姐什么| 自渎什么意思| 铠字五行属什么| 梦见死鸡是什么预兆| 日柱国印是什么意思| 眼压高是什么症状| 浑身酸痛什么原因| 阳亢是什么意思| 3月24日什么星座| 月经量少吃什么药| 女生右手食指戴戒指什么意思| 什么是水洗棉| 肛门溃烂用什么药膏| 义眼是什么| 宾馆和酒店有什么区别| 被螨虫咬了擦什么药膏| 煮中药用什么锅| 什么是放疗| 捡漏什么意思| 单亲是什么意思| 早上起床想吐是什么原因| 护发素什么牌子好| 背靠背什么意思| 失眠缺什么维生素| 肾结石可以喝什么饮料| 吃软不吃硬是什么生肖| 武则天原名叫什么| 孙子的儿子叫什么| 败血症吃什么药| 武汉大学校长是什么级别| 打鼾是什么原因导致的| 什么生机| 眉毛下方有痣代表什么| 血糖高吃什么中药好| 雾化治疗的作用是什么| 榆木脑袋是什么意思| 转氨酶和转移酶有什么区别| 沙门氏菌用什么药| 多巴胺是什么| 科目一和科目四有什么区别| 土地出让和划拨有什么区别| 妇科湿疹用什么药膏最有效| 补气血喝什么茶| 旺字五行属什么| 伸什么缩什么| 异性是什么意思| 富察氏是什么旗| 乙肝病毒表面抗体阳性是什么意思| 均码是什么意思| 比值是什么| 头晕眼花是什么原因| 4月20日是什么星座| bape是什么品牌| 舂米是什么意思| 什么的秃鹫| 神经系统是由什么组成的| 肺实性结节是什么意思| 积液是什么| 党工委书记是什么级别| 儿童遗尿挂什么科| vg是什么意思| 射精太快吃什么好| 骨量偏高代表什么意思| 脚踩棉花感见于什么病| 手筋鼓起来是什么原因| 什么情况需要做肠镜| 右肩膀疼痛预示什么病| 脑梗灶是什么意思| 急性肠胃炎有什么症状| 腮腺炎是什么原因引起的| 料酒和黄酒有什么区别| 谷氨酰基转移酶低是什么原因| 百度Jump to content

熊吃什么

From Wikipedia, the free encyclopedia
百度   上海交通大学  日日夜夜守候在寝室门口,只为向你问好,给我一个微笑可好?  同济大学  喵~不想拍广告~只想睡觉~  华东师范大学  只想做一只真正有“身份”的猫~哼!  上海外国语大学  好舒服啊~橘猫和打滚最配了~  上海财经大学  在SUFE的校园里,经常会看到它们萌萌的身影。

In software engineering, code coverage, also called test coverage, is a percentage measure of the degree to which the source code of a program is executed when a particular test suite is run. A program with high code coverage has more of its source code executed during testing, which suggests it has a lower chance of containing undetected software bugs compared to a program with low code coverage.[1][2] Many different metrics can be used to calculate test coverage. Some of the most basic are the percentage of program subroutines and the percentage of program statements called during execution of the test suite.

Code coverage was among the first methods invented for systematic software testing. The first published reference was by Miller and Maloney in Communications of the ACM, in 1963.[3]

Coverage criteria

[edit]

To measure what percentage of code has been executed by a test suite, one or more coverage criteria are used. These are usually defined as rules or requirements, which a test suite must satisfy.[4]

Basic coverage criteria

[edit]

There are a number of coverage criteria, but the main ones are:[5]

  • Function coverage – has each function (or subroutine) in the program been called?
  • Statement coverage – has each statement in the program been executed?
  • Edge coverage – has every edge in the control-flow graph been executed?
    • Branch coverage – has each branch (also called the DD-path) of each control structure (such as in if and case statements) been executed? For example, given an if statement, have both the true and false branches been executed? (This is a subset of edge coverage.)
  • Condition coverage – has each Boolean sub-expression evaluated both to true and false? (Also called predicate coverage.)

For example, consider the following C function:

int foo (int x, int y)
{
    int z = 0;
    if ((x > 0) && (y > 0))
    {
        z = x;
    }
    return z;
}

Assume this function is a part of some bigger program and this program was run with some test suite.

  • Function coverage will be satisfied if, during this execution, the function foo was called at least once.
  • Statement coverage for this function will be satisfied if it was called for example as foo(1,1), because in this case, every line in the function would be executed—including z = x;.
  • Branch coverage will be satisfied by tests calling foo(1,1) and foo(0,1) because, in the first case, both if conditions are met and z = x; is executed, while in the second case, the first condition, (x>0), is not satisfied, which prevents the execution of z = x;.
  • Condition coverage will be satisfied with tests that call foo(1,0), foo(0,1), and foo(1,1). These are necessary because in the first case, (x>0) is evaluated to true, while in the second, it is evaluated to false. At the same time, the first case makes (y>0) false, the second case does not evaluate (y>0) (because of the lazy-evaluation of the Boolean operator), the third case makes it true.

In programming languages that do not perform short-circuit evaluation, condition coverage does not necessarily imply branch coverage. For example, consider the following Pascal code fragment:

if a and b then

Condition coverage can be satisfied by two tests:

  • a=true, b=false
  • a=false, b=true

However, this set of tests does not satisfy branch coverage since neither case will meet the if condition.

Fault injection may be necessary to ensure that all conditions and branches of exception-handling code have adequate coverage during testing.

Modified condition/decision coverage

[edit]

A combination of function coverage and branch coverage is sometimes also called decision coverage. This criterion requires that every point of entry and exit in the program has been invoked at least once, and every decision in the program has taken on all possible outcomes at least once. In this context, the decision is a Boolean expression comprising conditions and zero or more Boolean operators. This definition is not the same as branch coverage,[6] however, the term decision coverage is sometimes used as a synonym for it.[7]

Condition/decision coverage requires that both decision and condition coverage be satisfied. However, for safety-critical applications (such as avionics software) it is often required that modified condition/decision coverage (MC/DC) be satisfied. This criterion extends condition/decision criteria with requirements that each condition should affect the decision outcome independently.

For example, consider the following code:

if (a or b) and c then

The condition/decision criteria will be satisfied by the following set of tests:

a b c
true true true
false false false

However, the above tests set will not satisfy modified condition/decision coverage, since in the first test, the value of 'b' and in the second test the value of 'c' would not influence the output. So, the following test set is needed to satisfy MC/DC:

a b c
false true false
false true true
false false true
true false true

Multiple condition coverage

[edit]

This criterion requires that all combinations of conditions inside each decision are tested. For example, the code fragment from the previous section will require eight tests:

a b c
false false false
false false true
false true false
false true true
true false false
true false true
true true false
true true true

Parameter value coverage

[edit]

Parameter value coverage (PVC) requires that in a method taking parameters, all the common values for such parameters be considered. The idea is that all common possible values for a parameter are tested.[8] For example, common values for a string are: 1) null, 2) empty, 3) whitespace (space, tabs, newline), 4) valid string, 5) invalid string, 6) single-byte string, 7) double-byte string. It may also be appropriate to use very long strings. Failure to test each possible parameter value may result in a bug. Testing only one of these could result in 100% code coverage as each line is covered, but as only one of seven options are tested, there is only 14.2% PVC.

Other coverage criteria

[edit]

There are further coverage criteria, which are used less often:

  • Linear Code Sequence and Jump (LCSAJ) coverage a.k.a. JJ-Path coverage – has every LCSAJ/JJ-path been executed?[9]
  • Path coverage – Has every possible route through a given part of the code been executed?
  • Entry/exit coverage – Has every possible call and return of the function been executed?
  • Loop coverage – Has every possible loop been executed zero times, once, and more than once?
  • State coverage – Has each state in a finite-state machine been reached and explored?
  • Data-flow coverage – Has each variable definition and its usage been reached and explored?[10]

Safety-critical or dependable applications are often required to demonstrate 100% of some form of test coverage. For example, the ECSS-E-ST-40C standard demands 100% statement and decision coverage for two out of four different criticality levels; for the other ones, target coverage values are up to negotiation between supplier and customer.[11] However, setting specific target values - and, in particular, 100% - has been criticized by practitioners for various reasons (cf.[12]) Martin Fowler writes: "I would be suspicious of anything like 100% - it would smell of someone writing tests to make the coverage numbers happy, but not thinking about what they are doing".[13]

Some of the coverage criteria above are connected. For instance, path coverage implies decision, statement and entry/exit coverage. Decision coverage implies statement coverage, because every statement is part of a branch.

Full path coverage, of the type described above, is usually impractical or impossible. Any module with a succession of decisions in it can have up to paths within it; loop constructs can result in an infinite number of paths. Many paths may also be infeasible, in that there is no input to the program under test that can cause that particular path to be executed. However, a general-purpose algorithm for identifying infeasible paths has been proven to be impossible (such an algorithm could be used to solve the halting problem).[14] Basis path testing is for instance a method of achieving complete branch coverage without achieving complete path coverage.[15]

Methods for practical path coverage testing instead attempt to identify classes of code paths that differ only in the number of loop executions, and to achieve "basis path" coverage the tester must cover all the path classes.[citation needed][clarification needed]

In practice

[edit]

The target software is built with special options or libraries and run under a controlled environment, to map every executed function to the function points in the source code. This allows testing parts of the target software that are rarely or never accessed under normal conditions, and helps reassure that the most important conditions (function points) have been tested. The resulting output is then analyzed to see what areas of code have not been exercised and the tests are updated to include these areas as necessary. Combined with other test coverage methods, the aim is to develop a rigorous, yet manageable, set of regression tests.

In implementing test coverage policies within a software development environment, one must consider the following:

  • What are coverage requirements for the end product certification and if so what level of test coverage is required? The typical level of rigor progression is as follows: Statement, Branch/Decision, Modified Condition/Decision Coverage (MC/DC), LCSAJ (Linear Code Sequence and Jump)
  • Will coverage be measured against tests that verify requirements levied on the system under test (DO-178B)?
  • Is the object code generated directly traceable to source code statements? Certain certifications, (i.e. DO-178B Level A) require coverage at the assembly level if this is not the case: "Then, additional verification should be performed on the object code to establish the correctness of such generated code sequences" (DO-178B) para-6.4.4.2.[16]

Software authors can look at test coverage results to devise additional tests and input or configuration sets to increase the coverage over vital functions. Two common forms of test coverage are statement (or line) coverage and branch (or edge) coverage. Line coverage reports on the execution footprint of testing in terms of which lines of code were executed to complete the test. Edge coverage reports which branches or code decision points were executed to complete the test. They both report a coverage metric, measured as a percentage. The meaning of this depends on what form(s) of coverage have been used, as 67% branch coverage is more comprehensive than 67% statement coverage.

Generally, test coverage tools incur computation and logging in addition to the actual program thereby slowing down the application, so typically this analysis is not done in production. As one might expect, there are classes of software that cannot be feasibly subjected to these coverage tests, though a degree of coverage mapping can be approximated through analysis rather than direct testing.

There are also some sorts of defects which are affected by such tools. In particular, some race conditions or similar real time sensitive operations can be masked when run under test environments; though conversely, some of these defects may become easier to find as a result of the additional overhead of the testing code.

Most professional software developers use C1 and C2 coverage. C1 stands for statement coverage and C2 for branch or condition coverage. With a combination of C1 and C2, it is possible to cover most statements in a code base. Statement coverage would also cover function coverage with entry and exit, loop, path, state flow, control flow and data flow coverage. With these methods, it is possible to achieve nearly 100% code coverage in most software projects.[17]

Notable code coverage tools

[edit]

Hardware manufacturers

[edit]

Software

[edit]

Usage in industry

[edit]

Test coverage is one consideration in the safety certification of avionics equipment. The guidelines by which avionics gear is certified by the Federal Aviation Administration (FAA) is documented in DO-178B[16] and DO-178C.[18]

Test coverage is also a requirement in part 6 of the automotive safety standard ISO 26262 Road Vehicles - Functional Safety.[19]

See also

[edit]

References

[edit]
  1. ^ Brader, Larry; Hilliker, Howie; Wills, Alan (March 2, 2013). "Chapter 2 Unit Testing: Testing the Inside". Testing for Continuous Delivery with Visual Studio 2012. Microsoft. p. 30. ISBN 978-1621140184. Retrieved 16 June 2016.
  2. ^ Williams, Laurie; Smith, Ben; Heckman, Sarah. "Test Coverage with EclEmma". Open Seminar Software Engineering. North Carolina State University. Archived from the original on 14 March 2016. Retrieved 16 June 2016.
  3. ^ Joan C. Miller, Clifford J. Maloney (February 1963). "Systematic mistake analysis of digital computer programs". Communications of the ACM. 6 (2). New York, NY, USA: ACM: 58–63. doi:10.1145/366246.366248. ISSN 0001-0782.
  4. ^ Paul Ammann, Jeff Offutt (2013). Introduction to Software Testing. Cambridge University Press.
  5. ^ Glenford J. Myers (2004). The Art of Software Testing, 2nd edition. Wiley. ISBN 0-471-46912-2.
  6. ^ Position Paper CAST-10 (June 2002). What is a "Decision" in Application of Modified Condition/Decision Coverage (MC/DC) and Decision Coverage (DC)?
  7. ^ MathWorks. Types of Model Coverage.
  8. ^ "Unit Testing with Parameter Value Coverage (PVC)".
  9. ^ M. R. Woodward, M. A. Hennell, "On the relationship between two control-flow coverage criteria: all JJ-paths and MCDC", Information and Software Technology 48 (2006) pp. 433-440
  10. ^ Ting Su, Ke Wu, Weikai Miao, Geguang Pu, Jifeng He, Yuting Chen, and Zhendong Su. "A Survey on Data-Flow Testing". ACM Comput. Surv. 50, 1, Article 5 (March 2017), 35 pages.
  11. ^ ECSS-E-ST-40C: Space engineering - Software. ECSS Secretariat, ESA-ESTEC. March, 2009
  12. ^ C. Prause, J. Werner, K. Hornig, S. Bosecker, M. Kuhrmann (2017): Is 100% Test Coverage a Reasonable Requirement? Lessons Learned from a Space Software Project. In: PROFES 2017. Springer. Last accessed: 2025-08-14
  13. ^ Martin Fowler's blog: TestCoverage. Last accessed: 2025-08-14
  14. ^ Dorf, Richard C.: Computers, Software Engineering, and Digital Devices, Chapter 12, pg. 15. CRC Press, 2006. ISBN 0-8493-7340-9, ISBN 978-0-8493-7340-4; via Google Book Search
  15. ^ Y.N. Srikant; Priti Shankar (2002). The Compiler Design Handbook: Optimizations and Machine Code Generation. CRC Press. p. 249. ISBN 978-1-4200-4057-9.
  16. ^ a b RTCA/DO-178B, Software Considerations in Airborne Systems and Equipment Certification, Radio Technical Commission for Aeronautics, December 1, 1992
  17. ^ Boris beizer (2009). Software testing techniques, 2nd edition. Dreamtech press. ISBN 978-81-7722-260-9.
  18. ^ RTCA/DO-178C, Software Considerations in Airborne Systems and Equipment Certification, Radio Technical Commission for Aeronautics, January, 2012.
  19. ^ ISO 26262-6:2011(en) Road vehicles -- Functional safety -- Part 6: Product development at the software level. International Standardization Organization.
卵巢黄体是什么意思 肚子怕冷是什么原因该怎么办 生源地是指什么 卵巢多囊症是什么原因造成 菊花什么时候扦插最好
酒店五行属什么 手术后吃什么 武松是什么生肖 脚踝肿什么原因 什么牌子的氨基酸洗面奶好
甲亢查什么项目 肾衰竭吃什么好 垂体是什么 护理专业主要学什么 尿液突然变深褐色是什么原因
常喝红茶有什么好处 酸麻胀痛痒各代表什么 羊水破了什么感觉 韩语欧巴是什么意思 扁桃体结石长什么样
牛肉和什么菜炒好吃hcv9jop4ns3r.cn 阴道发痒是什么原因hcv8jop0ns4r.cn 什么什么迷人的成语hcv8jop6ns6r.cn hpv58阳性是什么意思hcv8jop7ns4r.cn 柳丁是什么水果hcv8jop9ns3r.cn
巨蟹座男和什么座最配对hcv9jop2ns0r.cn yjs是什么意思hcv9jop6ns0r.cn 宫颈管积液什么意思hcv9jop2ns1r.cn 深水炸弹是什么意思hcv8jop8ns2r.cn 乳糜血是什么意思hcv8jop8ns0r.cn
累觉不爱是什么意思hcv9jop4ns2r.cn 什么样的脸型有福hcv9jop5ns5r.cn 35岁属什么生肖hcv8jop2ns7r.cn 孜然是什么bfb118.com 吃什么能让奶水变多hcv7jop9ns8r.cn
一般什么人会有美人尖hcv7jop6ns9r.cn 辣椒什么时候传入中国xjhesheng.com 修面皮是什么皮hcv7jop7ns3r.cn olp是什么意思hcv8jop9ns8r.cn 术后吃什么hcv9jop1ns1r.cn
百度