Various mature automated test generation tools exist for statically typed programming languages such as Java. Automatically generating unit tests for dynamically typed programming languages such as Python, however, is substantially more difficult due to the dynamic nature of these languages as well as the lack of type information. Our Pynguin framework provides automated unit test generation for Python. In this paper, we extend our previous work on Pynguin to support more aspects of the Python language, and by studying a larger variety of well-established state of the art test-generation algorithms, namely DynaMOSA, MIO, and MOSA. Furthermore, we improved our Pynguin tool to generate regression assertions, whose quality we also evaluate. Our experiments confirm that evolutionary algorithms can outperform random test generation also in the context of Python, and similar to the Java world, DynaMOSA yields the highest coverage results. However, our results also demonstrate that there are still fundamental remaining issues, such as inferring type information for code without this information, currently limiting the effectiveness of test generation for Python.
翻译:对于静态打字编程语言,例如爪哇语,有各种成熟的自动测试生成工具。但是,由于Python等动态打字编程语言的动态性质以及缺少类型信息,自动生成单元测试要困难得多。我们的Pynguin框架为Python提供自动单位生成测试。在本文中,我们扩大了我们以前关于Pynguin的工作,以支持Python语的更多方面,并研究了大量成熟的艺术测试生成算法,即DynMOSA、MIO和MOSA。此外,我们改进了我们的Pynguin工具,以生成回归描述,我们也评估了这些描述的质量。我们的实验证实,进化算法也可以在Python背景下和类似Java世界的随机生成,DynamMOSA生成了最高的覆盖结果。然而,我们的结果还表明,仍然存在一些根本性的问题,比如在没有这一信息的情况下推断代码类型信息,目前限制了Python测试生成的有效性。