Grafter: transplantation and differential testing for clones

Tianyi Zhang, Miryung KimICSE (Companion Volume) 2018 · OpenReview

Abstract

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/liqAeuM8s3U.
BibTeX
@inproceedings{zhang2018grafter,
  author = {Tianyi Zhang and Miryung Kim},
  title = {{Grafter: transplantation and differential testing for clones}},
  booktitle = {ICSE (Companion Volume)},
  year = {2018},
  url = {https://openreview.net/forum?id=Yc2-BoKmru},
}

Loading related content...

Figure