Testing Refactoring


Refactoring is one of the main common operation done by developers during the maintenance process of software systems.
Martin Fowler as a refactoring, a change made to the internal structure of software to make it easier to understand and cheaper to modify, without changing its observable behavior.
Such a basic definition implies a fundamental assumption, i.e., the refactoring is a safe operation. This means that, in an ideal world, developers should be able to perform such operations without introduce bugs, or inadvertently change the code behavior.
However, in the real practice this is not always true. Several tool nowadays offer support for automatic refactoring; however, developers don’t trust automatic refactoring engines. Indeed, they perform most of such operations manually. The same Fowler recommend to “never refactor without a proper test suite”.

Goal of the Master Project

Within this master project, the students should look for an evidence that refactoring operations are not always safe! In particular, they should investigate, what kind of refactoring is more prone to generate bugs; moreover, study the particular situations that can lead to a bug introduction of to a change in code behavior. Finally, a taxonomy of different problems introduced by each refactoring should be studied.

Task Description

The main tasks of the project are:

  • Explore the current literature on the topic;
  • develop a prototype tool in order to perform a wide-based refactoring on a source project;
  • be able to generate ad-hoc unit tests to test the performed refactoring and detect eventual defects introduced with them;
  • derive a taxonomy.


[1] Safe Refactorings - link

[2] Automated testing of refactoring engines - link

[3] On experimenting refactoring tools to remove code smells - link