Extracting Code Examples from Unit Test Cases
Mohammad Hossein Ghafari · 2014
Understanding how to properly use APIs of large libraries is difficult, error prone, and time consuming. Software developers resort to study to learn APIs. Several approaches have been proposed to mine these examples, but the sources from which they mine examples as well as their mining approaches hamper their applicability in some practical scenarios. Unit test cases seem to be an additional source of significant API examples, which may overcome the aforementioned difficulties. Synthesizing meaningful examples from tests not only improves the applicability of current code recommendation systems, but also facilitates providing up to date API examples to augment documentation. However, mining examples of API use from unit tests is a non trivial task and arises several research challenges summarized in this paper.