Modern programming languages (e.g., Java and C#) provide features to separate error-handling code from regular code, seeking to enhance software comprehensibility and maintainability. Nevertheless, the way exception handling (EH) code is structured in such languages may lead to multiple, different, and complex control flows, which may affect the software testability. Previous studies have reported that EH code is typically neglected, not well tested, and its misuse can lead to reliability degradation and catastrophic failures. However, little is known about the relationship between testing practices and EH testing effectiveness. In this exploratory study, we (i) measured the adequacy degree of EH testing concerning code coverage (instruction, branch, and method) criteria; and (ii) evaluated the effectiveness of the EH testing by measuring its capability to detect artificially injected faults (i.e., mutants) using 7 EH mutation operators. Our study was performed using test suites of 27 long-lived Java libraries from open-source ecosystems. Our results show that instructions and branches within $\mathtt{catch}$ blocks and $\mathtt{throw}$ instructions are less covered, with statistical significance than the overall instructions and branches. Nevertheless, most of the studied libraries presented test suites capable of detecting more than 70% of the injected faults. From a total of 12,331 mutants created in this study, the test suites were able to detect 68% of them.
翻译:现代编程语言(例如,爪哇和C#)提供了将错误处理代码与常规代码分开的特性,目的是提高软件的可理解性和可维护性。然而,例外处理(EH)代码的方式在这类语言中的结构结构上可能导致多重、不同和复杂的控制流,这可能影响软件的可测试性。先前的研究报告说,EH代码通常被忽视,没有很好地测试,其滥用可能导致可靠性退化和灾难性的失败。然而,测试做法和EH测试有效性之间的关系却鲜为人知。在这项探索研究中,我们(一)测量了有关代码覆盖范围(指令、分支和方法)的EH测试的适当程度;以及(二)通过测量其使用7 EH 变异体操作者检测人工输入错误的能力,评估EH代码的有效性。我们的研究使用27个长寿命的Java图书馆的测试套房进行,而我们的研究显示,$\matht{hatch}$xxxxxxxxxxxxxxxxxxxxxxxxxxxxx