JORGE, D. N.; http://lattes.cnpq.br/2682324004823239; JORGE, Dalton Nicodemos.
Abstract:
Software testing is an essential activity in system development, as it minimizes the
possibility of manifesting problems and maximizes the chances that the production
code meets its specifications. However, just as a poor design choice (bad smell) affects
the production code, tests are also susceptible to the same type of problem. Thus, a
test indicating possible design defects (test smell) can lead to challenges ranging from
code readability, making maintenance difficult, to being prone to giving false positives
or simply ceasing to function. Indeed, test smells are anti-patterns adopted in the test
code implementation. These smells can vary or trigger the emergence of new types,
depending on the language or technology used for test writing.
In parallel, the JavaScript language has developed over decades since its incep tion and a notable evolution since 2015 with the ECMAScript 6 (ES6) specification.
JavaScript is a high-level language, which includes the following peculiarities: being
multi-paradigm, interpreted, using dynamic typing, having prototype-based object ori entation, and even first-class functions. Given this, we focused our study on smells
in JavaScript, because it is a constantly evolving language and widely used to develop
software on various platforms, such as: servers, desktop, command line, mobile systems,
and the internet of things.
In summary, the aim of this study is to investigate the occurrence and severity of
classic and specific test smells in the JavaScript language, and to check if these anti patterns might be correlated with each other and with the quality metrics of the test
code. To achieve this goal, we initially selected 15 classic smells from the literature and
one inherent to the language, to assess their occurrence in the test code. To facilitate
the detection of smells and validate our study, we developed an automated detection
tool for these 16 smells using the static code analysis technique and conducted an
exploratory study with 65 projects, 61 open-source and 4 proprietary. As results, we
concluded that the incidence of some of these test smells is moderately correlated with
each other and with quality metrics in a positive sense.
Additionally, we conducted a complementary study involving developers and testers
with the aim of investigating the impact of experience on the recognition of these smells
1
2
in JavaScript. This study aimed to understand not only the prevalence of specific test
smells in the perception of these professionals, but also the strategies and tools they
used to mitigate such anti-patterns. This aspect of the study allowed us to assess
the awareness and practices adopted in the real context of software development and
testing, enriching the understanding of the challenges faced and the possible applicable
solutions.
With this study, we hope to have contributed to the initial formalization of test
smell studies in the JavaScript language, considering that although it has been increas ingly used in various development contexts, it had not yet been academically explored
regarding its specifics and ramifications in the realm of test smells.