Reanimator: from Test Data to Code and Back

State-of-the-art automatic testing tools can efficiently detect various kinds of errors in software projects; however, these errors often cannot be automatically extracted to a standalone reproducing test case, a feature valuable for the purposes of further software maintenance. Objects present the main difficulty, as generating code to construct an object given its state is hard, due to the encapsulation principle. In this paper we present an approach called Reanimator that, given an object representation, is able to generate a valid code snippet which constructs this object using its publicly available API. Reanimator can be applied to any automatic testing tool to help it generate reproducing test cases for detected failures. We implemented our approach as a part of an automatic testing tool called Kex and evaluated it on a number of open-source projects from GitHub. Evaluation results showed that our approach is compatible with the state of the art techniques.