An Empirical Study of Testability in JavaScript Projects
URL | http://edoc.sub.uni-hamburg.de/informatik/volltexte/2024/277/ |
---|---|
Dokumentart: | Master Thesis |
Institut: | Fachbereich Informatik |
Sprache: | Englisch |
Erstellungsjahr: | 2023 |
Publikationsdatum: | 29.10.2024 |
Freie Schlagwörter (Deutsch): | Testbarkeit , JavaScript , Open Source , Refactoring , GitHub |
Freie Schlagwörter (Englisch): | Testability , JavaScript , Open Source , Refactoring , GitHub |
DDC-Sachgruppe: | Informatik |
BK - Klassifikation: | 54.00 |
Kurzfassung auf Englisch:
Testability is a quality attribute of software that enables an efficient testing process where faults are likely to be found. Testability has been a subject of scientific research for decades, but there are gaps to be filled. Most research in this field focuses on Java, which is not the only relevant language in today’s software development. This thesis focuses on JavaScript as a versatile language that is frequently used in many frontend and backend applications. The goal of this work is to answer two main research questions. The first question is the following: What is the level of testability in JavaScript open-source projects and what are the characteristics of testable JavaScript? The question complements existing research for Java to analyze the impact of JavaScript’s particularities on how testability is reflected in the source code. Additionally, observations about the testability level across the analyzed projects are made. An empirical study on a newly created dataset of 384 public open-source JavaScript and TypeScript repositories is done to find source code metrics that indicate the level of testability. The creation process was designed for reusability in future studies. 39% of the repositories contained at least one test case. Testability metrics were selected by performing a correlation analysis between pairs of test and source code metrics. A scoring system built on the resulting set of 34 metrics is proposed that can be applied by a developer to assess the testability of source code. The findings are that TypeScript appears to be more testable across open-source projects and that the level of testability seems to depend on the application area. Also, projects that contain test cases appear to have higher testability on average. The second research question is: What refactorings are done in JavaScript open-source projects to enhance testability? Complementing a recent study on Java projects, the goal was to find out how developers improve testability in JavaScript open-source projects and how this information can be used to guide developers in refactoring their code for better testability. In a semi-automated process, refactorings were searched in a set of 802 commits that modify related test and source code files. Every commit was manually reviewed to identify refactorings for testability. In total, 42 testability refactorings have been found. Derived from them, ten refactoring procedures are proposed to improve testability in certain scenarios.
Hinweis zum Urherberrecht
Für Dokumente, die in elektronischer Form über Datenenetze angeboten werden, gilt uneingeschränkt das Urheberrechtsgesetz (UrhG). Insbesondere gilt:
Einzelne Vervielfältigungen, z.B. Kopien und Ausdrucke, dürfen nur zum privaten und sonstigen eigenen Gebrauch angefertigt werden (Paragraph 53 Urheberrecht). Die Herstellung und Verbreitung von weiteren Reproduktionen ist nur mit ausdrücklicher Genehmigung des Urhebers gestattet.
Der Benutzer ist für die Einhaltung der Rechtsvorschriften selbst verantwortlich und kann bei Mißbrauch haftbar gemacht werden.