Poster: Grafter: Transplantation and Differential Testing for Clones

Code clones are common in software. When applying similar edits to clones, developers often find it difficult to examine the runtime behavior of clones. The problem is exacerbated when some clones are tested, while their counterparts are not. To reuse tests for similar but not identical clones, Grafter transplants one clone to its counterpart by (1) identifying variations in identifier names, types, and method call targets, (2) resolving compilation errors caused by such variations through code transformation, and (3) inserting stub code to transfer input data and intermediate output values for examination. To help developers examine behavioral differences between clones, Grafter supports fine-grained differential testing at both the test outcome level and the internal program state level. Our evaluation shows that Grafter can successfully reuse tests and detect behavioral differences. The tool is available for download at http://web.cs.ucla.edu/~tianyi.zhang/grafter.html and the demo video is available at https://youtu.be/1iqAeuM8s3U.

[1]  Robert J. Walker,et al.  Validating pragmatic reuse tasks by leveraging existing test suites , 2013, Softw. Pract. Exp..

[2]  Zhendong Su,et al.  Context-based detection of clone-related bugs , 2007, ESEC-FSE '07.

[3]  Robert J. Walker,et al.  Systematizing pragmatic software reuse , 2012, TSEM.

[4]  Miryung Kim,et al.  Interactive Code Review for Systematic Changes , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[5]  Miryung Kim,et al.  Automated Transplantation and Differential Testing for Clones , 2017, 2017 IEEE/ACM 39th International Conference on Software Engineering (ICSE).

[6]  Name M. Lastname Automatically Finding Patches Using Genetic Programming , 2013 .

[7]  Mark Harman,et al.  Automated software transplantation , 2015, ISSTA.