Investigating the Developer’s Perceptions of Unit Testing and Its Practice - Santos, Lidvaldo; Santos, Fernanda; Parreira, Renan; de Mello, Rafael (Anais da Escola Regional de Engenharia de Software (ERES); 2023: Anais da VII Escola Regional de Engenharia de SoftwareDO - 10.5753/eres.2023.237778, 2023)
Unit testing is an important and largely disseminated software engineering activity, contributing to the prevention of defects in source code elements before running more comprehensive tests. However, developers typically perform unit tests ad-hoc, lacking in coverage and quality. Consequently, the unit testing practice remains informal and strongly influenced by developers’ initiative. We report in this paper an opinion survey on the developers’ perceptions of unit testing and its practice. We conducted the survey with 32 developers from two Brazilian companies. The survey findings revealed that developers from both companies tend to share positive beliefs about the relevance of unit testing. However, they also tend to share negative perceptions about its practice in their working environments. Besides, we found a positive moderate correlation between the developers’ motivation and their perceptions about the training, frequency, and time allocated for unit testing. The survey results reveal the dissonance between the developers’ beliefs about unit testing and their practice, influenced by issues in their working environments. This dissonance may lead to a lack of commitment and internal conflicts.