Analysis and Maintainability of Complex Industry Test Code Using Clone Detection

It appears your Web browser is not configured to display PDF files. Download adobe Acrobat or click here to download the PDF file.

Click here to download the PDF file.


Hasanain, Wafa Othman Ahmad




Many companies, including Ericsson, experience increased software verification costs. Agile cross-functional teams find it easy to make new additions of test cases for every change and fix. The consequence of this phenomenon is the duplications of test code, which is often referred to as code clone. In this thesis, we attempt to understand the prevalence of test code clones, thus contributing to the clone detection and software testing fields, and we then study how test code can be refactored to remove clones, therefore improving software testing activities. In this thesis, we aim to achieve the following goals. Firstly, we aim to detect clones in industry test codes. We found 49% of lines of code of the entire C test code are clones; We found 73% of lines of code of the entire Java test code is a clone. The results we report on in our study include figures about clone frequencies, types, similarity, size distributions, and number of line differences in cloned test cases. Secondly, following standard definitions of clone types, if the source code contains fragments that are in a Type-1 clone class, we theoretical argue and empirically confirm that those fragments belong to a Type-2 clone class; Such inclusions occur with Type-3 clone classes. When one relies on standard definitions of source code clone types, they are therefore running a risk of overlapping information being returned for different types of clone classes. This leads us to refine the standard terminology on clone types to avoid possible miss-interpretations of clone detection results and define and implement a Clone Reduction Procedure to remove overlapping clone detection information.We then use this tool infrastructure to empirically study the extent of overlapping information in clone detection results produced by NiCad. The third goal is to refactor test code clones. Refactoring is about restructuring and enhancing existing code without altering behaviour to improve maintainability. We aim to identify the clone tests that may appear to be good opportunities for refactoring test codes according to well defined or to be discovered test patterns so that refactored test code is easy to enhance, understand, and maintain.


System Science
Computer Science




Carleton University

Thesis Degree Name: 

Doctor of Philosophy: 

Thesis Degree Level: 


Thesis Degree Discipline: 

Engineering, Electrical and Computer

Parent Collection: 

Theses and Dissertations

Items in CURVE are protected by copyright, with all rights reserved, unless otherwise indicated. They are made available with permission from the author(s).