Studying the impact of early test termination due to assertion failure on code coverage and spectrum-based fault localization
dc.contributor.author | Uddin, Md. Ashraf | |
dc.contributor.examiningcommittee | Thulasiraman, Parimala (Computer Science) | |
dc.contributor.examiningcommittee | Rouhani, Sara (Computer Science) | |
dc.contributor.supervisor | Wang, Shaowei | |
dc.date.accessioned | 2023-08-28T16:01:56Z | |
dc.date.available | 2023-08-28T16:01:56Z | |
dc.date.issued | 2023-08-15 | |
dc.date.submitted | 2023-08-21T01:54:21Z | en_US |
dc.degree.discipline | Computer Science | en_US |
dc.degree.level | Master of Science (M.Sc.) | |
dc.description.abstract | An assertion is commonly used to validate the expected program’s behavior (e.g., if the returned value of a method equals an expected value) in software testing. Although it is a recommended practice to use only one assertion in a single test to avoid code smell (e.g., Assertion Roulette), we observe that it is common to have multiple assertions in a single test. One issue with tests that have multiple assertions is that when the test fails at an early assertion, the test will terminate at that point, and the remaining testing code will not be executed. This, in turn, can potentially reduce the code coverage and the performance of techniques that rely on code coverage information (e.g., spectrum-based fault localization). We refer to such a scenario as early test termination. Understanding the impact of early test termination on test coverage is important for software testing and debugging, particularly for the techniques that rely on coverage information obtained from the testing. In this study, we investigated 207 versions of 6 open-source projects. We found that a non-negligible portion of the failed tests (19.1%) is early terminated due to assertion failure, which leads to the skipping of 15.3% to 60.5% of the test code on average, and a negative impact on testing coverage. To mitigate early test termination, we propose two approaches, i.e., Trycatch (adding a try-catch block surrounding an assertion) and Slicing (slicing a test into a set of independent sub-tests, in which only one assertion and its dependent code are contained). After applying our approaches, the line/branch coverage get improved in 55% of the studied versions. Moreover, Slicing improves the performance of SBFL by 15.1% and 10.66% in terms of Mean First Rank (MFR) for Ochiai and Tarantula, respectively. We also provide actionable suggestions to prevent early test termination, and approaches to mitigate early test termination if it already exists in their project. | |
dc.description.note | October 2023 | |
dc.identifier.uri | http://hdl.handle.net/1993/37498 | |
dc.language.iso | eng | |
dc.rights | open access | en_US |
dc.subject | Coverage | |
dc.subject | Fault Localization | |
dc.subject | Assertion Failure | |
dc.subject | Early Test Termination | |
dc.title | Studying the impact of early test termination due to assertion failure on code coverage and spectrum-based fault localization | |
dc.type | master thesis | en_US |
local.subject.manitoba | no | |
oaire.awardNumber | RGPIN-2021-03354 | |
oaire.awardTitle | NSERC – Discovery Grants | |
oaire.awardURI | https://www.nserc-crsng.gc.ca/ase-oro/Details-Detailles_eng.asp?id=742509 | |
project.funder.identifier | NSERC: https://doi.org/10.13039/501100000038 | |
project.funder.name | Natural Sciences and Engineering Research Council of Canada |