arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.16639cs.SE
收藏

探究测试代码的可读性:结合科学与实践视角

Investigating the Readability of Test Code: Combining Scientific and Practical Views

Dietmar Winkler, Pirmin Urbanke, Rudolf Ramler

AI总结:

本研究结合科学文献与灰色文献综述及对照实验,识别出14个影响测试代码可读性的因素,揭示了学术界与工业界在关键因素上的共识与差异,强调需融合双方观点以达成对软件测试代码可读性的统一认识。

摘要:

源代码的可读性对于理解和维护软件系统及测试至关重要。多项研究调查了源代码的可读性,但关于测试代码的可读性及其相关影响因素的研究十分有限。我们从学术视角结合实践观点,调查了影响测试代码可读性的因素。首先,我们开展了一项 Systematic Mapping Study (SMS),重点关注科学文献。其次,我们通过审查灰色文献来源,扩展了这项研究,以获取关于测试代码可读性和可理解性的实践层面内容。最后,我们对选定的一组测试用例的可读性进行了对照实验,以收集实践中讨论的影响因素的额外知识。SMS 的结果集包含来自科学文献的 19 项初步研究。灰色文献检索揭示了 62 个关于测试代码可读性信息的来源。基于对这些来源的分析,我们确定了一组共 14 个影响测试代码可读性的因素。其中 7 个因素在科学和灰色文献中均有发现,而部分因素主要在学术界(2 个)或工业界(5 个)讨论,重叠有限。针对与实践相关影响因素的对照实验表明,对于一半的选定测试用例,所调查的因素对其可读性有显著影响。我们对科学和灰色文献的审查表明,测试代码可读性引起了学术界和工业界的兴趣,并在关键影响因素上达成了共识。然而,我们也发现了仅由从业者讨论的因素。对于其中部分因素,我们能够在首次实验中证实其对可读性的影响。因此,我们认为有必要将学术界和工业界的观点结合起来,以形成对软件测试代码可读性的共识。

英文摘要:

The readability of source code is key for understanding and maintaining software systems and tests. Several studies investigate the readability of source code, but there is limited research on the readability of test code and related influence factors. We investigate the factors that influence the readability of test code from an academic perspective complemented by practical views. First, we perform a Systematic Mapping Study (SMS) with a focus on scientific literature. Second, we extend this study by reviewing grey literature sources for practical aspects on test code readability and understandability. Finally, we conduct a controlled experiment on the readability of a selected set of test cases to collect additional knowledge on influence factors discussed in practice. The result set of the SMS includes 19 primary studies from the scientific literature. The grey literature search reveals 62 sources for information on test code readability. Based on an analysis of these sources, we identified a combined set of 14 factors that influence the readability of test code. 7 of these factors were found in scientific and grey literature, while some factors were mainly discussed in academia (2) or industry (5) with limited overlap. The controlled experiment on practically relevant influence factors showed that the investigated factors have a significant impact on readability for half of the selected test cases. Our review of scientific and grey literature showed that test code readability is of interest for academia and industry with a consensus on key influence factors. However, we also found factors only discussed by practitioners. For some of these factors we were able to confirm an impact on readability in a first experiment. Therefore, we see the need to bring together academic and industry viewpoints to achieve a common view on the readability of software test code.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑