Politecnico di Torino (logo)

Weighted code coverage: a tool to combine code metrics and code coverage into new metrics

Giovanni Tangredi

Weighted code coverage: a tool to combine code metrics and code coverage into new metrics.

Rel. Luca Ardito, Maurizio Morisio, Michele Valsesia. Politecnico di Torino, Corso di laurea magistrale in Ingegneria Informatica (Computer Engineering), 2022

PDF (Tesi_di_laurea) - Tesi
Licenza: Creative Commons Attribution Non-commercial No Derivatives.

Download (3MB) | Preview

Context: The usage of Software metrics is well consolidated in software development. Code metrics are software metrics that define methods to measure source code properties. Using these measures, programmers can have a picture of the status of a source code, identify potentially problematic parts, and improve the code during its maintenance. Code Coverage metrics are used to measure the percentage of code covered by a test suite. Knowing the coverage value, a developer can improve the code by adding tests to parts of code not covered since these parts may contain bugs or unwanted changes. Code metrics and coverage are the foundations for creating the metrics proposed in this thesis, which aim to combine these two aspects. Objectives: This thesis has three main objectives. The first one describes an open-source software developed by Mozilla, called Rust Code Analysis, and the series of contributions done to this project. The second one is to describe Weighted Code Coverage, the tool developed during this thesis, containing the implementation of the new metrics mentioned above. The third one is to study the added value of these new metrics and show how a developer might use them. Method: The work done during this thesis can be divided into two main parts. In the first part, we have researched all metrics that are then being implemented into Weighted Code Coverage. In addition, we added the minimum and maximum for some metrics already implemented in Rust Code Analysis. The second part mainly focused on implementing the researched metrics and developing Weighted Code Coverage according to good coding practice. During this stage, we have also improved the tool in performance and memory usage and performed a series of analyses on different repositories. These analyses have been subdivided into two categories: spatial and time analyses. The spatial analysis focuses on understanding the behaviors of the tool on codebases of different sizes. Instead, time analysis observes how the results obtained by the program change for different versions of the same codebase. Conclusions: The work produced in this thesis consisted of implementing weighted code coverage, a tool that implements four new metrics types. The tool has been written in Rust programming language, and it computes its metrics starting from a series of source codes also written in Rust. Since the project is open source, future contributors can extend Weighted Code Coverage, adding metrics for other programming languages. At last, we have shown the behavior of these metrics in actively maintained repositories, specifying which could be their potential uses.

Relators: Luca Ardito, Maurizio Morisio, Michele Valsesia
Academic year: 2022/23
Publication type: Electronic
Number of Pages: 97
Corso di laurea: Corso di laurea magistrale in Ingegneria Informatica (Computer Engineering)
Classe di laurea: New organization > Master science > LM-32 - COMPUTER SYSTEMS ENGINEERING
Aziende collaboratrici: UNSPECIFIED
URI: http://webthesis.biblio.polito.it/id/eprint/24508
Modify record (reserved for operators) Modify record (reserved for operators)