单元测试的代码会崩溃吗?一项关于 Eclipse 的案例研究
Does Unit-Tested Code Crash? A Case Study of Eclipse
AI总结:
本文以 Eclipse 项目为案例,通过分析大量崩溃报告与 JaCoCo 测试覆盖率数据,发现单元测试代码并未减少现场故障,表明单元测试本身不足以防止程序故障。
摘要:
背景:软件开发项目越来越多地采用单元测试,以便在构建过程的早期识别和纠正程序缺陷。因此,经过单元测试的代码应当具有更少的与之相关的故障。目标:比较经过单元测试的代码与未经过单元测试的代码中出现的现场故障数量。方法:我们获取了与 Eclipse 集成开发环境项目相关的 2,083,979 份崩溃事件报告,并对其进行处理,得到与某个特定流行版本相关的 126,026 个唯一程序故障堆栈跟踪。随后,我们在同一版本上运行 JaCoCo 代码测试覆盖率分析,获得 216,392 个方法在行级、指令级和分支级的覆盖率结果。我们还从源代码中提取了与相应测试类关联的类,以便将测试代码覆盖率结果限定在具有实际测试的 1,267 个类中。最后,我们在 9,523 个失败的已测试方法层面将单元测试与故障进行了关联分析。结果:单元测试的代码似乎并未表现出更少的故障。结论:单元测试本身可能不是防止程序故障的充分方法。
英文摘要:
Context: Software development projects increasingly adopt unit testing as a way to identify and correct program faults early in the construction process. Code that is unit tested should therefore have fewer failures associated with it. Objective: Compare the number of field failures arising in unit tested code against those arising in code that has not been unit tested. Method: We retrieved 2,083,979 crash incident reports associated with the Eclipse integrated development environment project, and processed them to obtain a set of 126,026 unique program failure stack traces associated with a specific popular release. We then run the JaCoCo code test coverage analysis on the same release, obtaining results on the line, instruction, and branch-level coverage of 216,392 methods. We also extracted from the source code the classes that are linked to a corresponding test class so as to limit test code coverage results to 1,267 classes with actual tests. Finally, we correlated unit tests with failures at the level of 9,523 failing tested methods. Results: Unit-tested code does not appear to be associated with fewer failures. Conclusion: Unit testing on its own may not be a sufficient method for preventing program failures.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。