Unit testing is a vital part of the software development process and involves developers writing code to verify or assert production code. Furthermore, to help comprehend the test case and troubleshoot issues, developers have the option to provide a message that explains the reason for the assertion failure. In this exploratory empirical study, we examine the characteristics of assertion messages contained in the test methods in 20 open-source Java systems. Our findings show that while developers rarely utilize the option of supplying a message, those who do, either compose it of only string literals, identifiers, or a combination of both types. Using standard English readability measuring techniques, we observe that a beginner's knowledge of English is required to understand messages containing only identifiers, while a 4th-grade education level is required to understand messages composed of string literals. We also discuss shortcomings with using such readability measuring techniques and common anti-patterns in assert message construction. We envision our results incorporated into code quality tools that appraise the understandability of assertion messages.
翻译:单位测试是软件开发过程的一个重要部分,涉及开发商为核查或维护生产代码撰写代码。此外,为了帮助理解测试案例和故障排除问题,开发商可以选择提供一个信息来解释断言失败的原因。在这项探索性实验性实验研究中,我们研究了20个开放源码爪哇系统中测试方法所含的断言信息的特点。我们的研究结果表明,虽然开发商很少使用提供信息的选项,但开发商要么只使用字符串字典、识别符号,要么将这两种类型组合起来。我们发现,使用标准的英语可读性测量技术,需要初学者的英语知识来理解仅包含识别符号的信息,而需要四年级教育水平来理解由字符串字串字串组成的信息。我们还讨论了使用这种可读性测量技术和常用的反模式来构建信息方面的缺点。我们设想,我们的结果将纳入到用于评估断言信息可理解性的代码质量工具中。</s>