Inline Tests

Inline Tests
复制标题

DOI:
10.1145/3551349.3556952
复制
发表时间:
2022-09
期刊:
Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering
影响因子:
--
通讯作者:
Yu Liu;Pengyu Nie;Owolabi Legunsen;Miloš Gligorić
Yu Liu;Pengyu Nie;Owolabi Legunsen;Miloš Gligorić
中科院分区:
其他
文献类型:
--
作者:
Yu Liu;Pengyu Nie;Owolabi Legunsen;Miloš Gligorić

文献摘要

被引文献

相似文献

单元测试被广泛用于检查源代码质量,但是它们可能过于粗粒度,或者不适合测试单个程序语句。我们引入内联测试是为了更容易检查语句中的错误。我们通过几个语言特性和一个常见的测试场景来激发内联测试,在这些场景中,内联测试可能是有益的。例如,内联测试允许开发人员就地测试正则表达式。我们还为内联测试框架定义了与语言无关的需求。最后,我们实现I-Test,这是第一个内联测试框架。I-Test适用于Python和Java,它满足大多数需求。我们通过使用I-Test在开源项目中测试31个Python程序和37个Java程序中的144条语句来评估I-Test。我们还进行了用户研究。所有九个用户研究参与者都说内联测试很容易编写,而且内联测试是有益的。运行内联测试的成本可以忽略不计,在0.007x-0.014x之间,我们的内联测试帮助发现了两个已经被开发人员修复的错误。
Unit tests are widely used to check source code quality, but they can be too coarse-grained or ill-suited for testing individual program statements. We introduce inline tests to make it easier to check for faults in statements. We motivate inline tests through several language features and a common testing scenario in which inline tests could be beneficial. For example, inline tests can allow a developer to test a regular expression in place. We also define language-agnostic requirements for inline testing frameworks. Lastly, we implement I-Test, the first inline testing framework. I-Test works for Python and Java, and it satisfies most of the requirements. We evaluate I-Test on open-source projects by using it to test 144 statements in 31 Python programs and 37 Java programs. We also perform a user study. All nine user study participants say that inline tests are easy to write and that inline testing is beneficial. The cost of running inline tests is negligible, at 0.007x–0.014x, and our inline tests helped find two faults that have been fixed by the developers.