AmPyfier: Test amplification in Python. Issue 11 (24th July 2022) - Schoofs, Ebert; Abdi, Mehrdad; Demeyer, Serge
Abstract: Test amplification aims to automatically improve a test suite. One technique generates new test methods through transformations of the original tests. These test amplification tools heavily rely on analysis techniques that benefit a lot from type declarations present in the source code of projects written in statically typed languages. In dynamically typed languages, such type declarations are not available, and therefore, research regarding test amplification for those languages is sparse. Recent work has brought test amplification to the dynamically typed language Pharo Smalltalk by introducing the concept of dynamic type profiling. The technique is dependent on Pharo‐specific frameworks and has not yet been generalized to other languages. Another significant downside in test amplification tools based on the mutation score of a test suite is their high time cost. In this paper, we present AmPyfier, a tool that brings test amplification and type profiling to the dynamically typed language Python. AmPyfier introduces multi‐metric selection in order to increase the time efficiency of test amplification. We evaluated AmPyfier on 11 open‐source projects and found that AmPyfier could strengthen 37 out of 54 test classes. Multi‐metric selection decreased the time cost ranging from 17% to 98% as opposed to selection based on the full mutation score. Abstract : AmPyfier extends test amplification through generalization of dynamic type profiling to one of the most popular dynamically typed languages, Python. Thanks to multi‐metric selection, AmPyfier decreases the time‐cost of test amplification while increasing the efficiency. With multi‐metric selection, mutants are dynamically generated for (newly) covered code in the project under test, and amplified test methods are scored against both code coverage and mutation score resulting in a strengthened test suite.