Automated Unit Test Generation for Python
arXiv:2007.14049 · doi:10.1007/978-3-030-59762-7_2
Abstract
Automated unit test generation is an established research field, and mature test generation tools exist for statically typed programming languages such as Java. It is, however, substantially more difficult to automatically generate supportive tests for dynamically typed programming languages such as Python, due to the lack of type information and the dynamic nature of the language. In this paper, we describe a foray into the problem of unit test generation for dynamically typed languages. We introduce Pynguin, an automated unit test generation framework for Python. Using Pynguin, we aim to empirically shed light on two central questions: (1) Do well-established search-based test generation methods, previously evaluated only on statically typed languages, generalise to dynamically typed languages? (2) What is the influence of incomplete type information and dynamic typing on the problem of automated test generation? Our experiments confirm that evolutionary algorithms can outperform random test generation also in the context of Python, and can even alleviate the problem of absent type information to some degree. However, our results demonstrate that dynamic typing nevertheless poses a fundamental issue for test generation, suggesting future work on integrating type inference.
15 pages, to be published in Proceedings of the 12th Symposium on Search-Based Software Engineering (SSBSE 2020)
Cited by in corpus (8)
- TOGA: A Neural Method for Test Oracle Generation
- Pynguin: Automated Unit Test Generation for Python
- Two is Better Than One: Digital Siblings to Improve Autonomous Driving Testing
- GenMorph: Automatically Generating Metamorphic Relations via Genetic Programming
- Small-Amp: Test Amplification in a Dynamically Typed Language
- JUGE: An Infrastructure for Benchmarking Java Unit Test Generators
- Beyond Accuracy: An Empirical Study on Unit Testing in Open-source Deep Learning Projects
- An Annotation-based Approach for Finding Bugs in Neural Network Programs