Unit testing of an open-source project in Python
KC, Sirisan (2025)
Kandidaatintyö
KC, Sirisan
2025
School of Engineering Science, Tietotekniikka
Kaikki oikeudet pidätetään.
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi-fe2026052755651
https://urn.fi/URN:NBN:fi-fe2026052755651
Tiivistelmä
Unit testing is a fundamental software engineering practice that supports early defect detection, improves software reliability, and facilitates long-term maintainability. Despite its importance, many open-source Python projects lack sufficient or high-quality unit tests. This thesis investigates unit testing in the context of an open-source Python project with the objective of designing, implementing, and evaluating unit tests using established quality metrics.
The study follows the Design Science Research (DSR) methodology, where the developed artefact consists of pytest-based unit tests implemented for the selected open-source project OpenCAQDA. The implementation focuses on utility and service modules of the project and applies established unit testing principles and best practices. Existing unittest-based tests were analysed and used as a baseline for designing additional tests. The quality of the implemented unit tests is evaluated using multiple complementary metrics derived from prior research, including code coverage, unit test accuracy, and unit test code quality.
The results indicate that the implemented pytest-based tests improve code coverage from approximately 27% to 57% for the selected modules and effectively detect faults in the tested components. The evaluation also shows that test quality depends not only on coverage but also on readability and maintainability. Overall, the thesis demonstrates that systematic unit test implementation and multi-metric evaluation can enhance software quality in opensource Python projects.
The study follows the Design Science Research (DSR) methodology, where the developed artefact consists of pytest-based unit tests implemented for the selected open-source project OpenCAQDA. The implementation focuses on utility and service modules of the project and applies established unit testing principles and best practices. Existing unittest-based tests were analysed and used as a baseline for designing additional tests. The quality of the implemented unit tests is evaluated using multiple complementary metrics derived from prior research, including code coverage, unit test accuracy, and unit test code quality.
The results indicate that the implemented pytest-based tests improve code coverage from approximately 27% to 57% for the selected modules and effectively detect faults in the tested components. The evaluation also shows that test quality depends not only on coverage but also on readability and maintainability. Overall, the thesis demonstrates that systematic unit test implementation and multi-metric evaluation can enhance software quality in opensource Python projects.
